diff --git a/.directory b/.directory index 3c542a57825472d4040219bc90100e30f278cfa4..12b136299e653255777fcf2f362c56e0a7cd1d2b 100644 --- a/.directory +++ b/.directory @@ -1,3 +1,6 @@ [Dolphin] -Timestamp=2012,12,17,17,4,38 +Timestamp=2013,1,7,14,37,46 Version=3 + +[Settings] +HiddenFilesShown=true diff --git a/.gitignore b/.gitignore index d08a834f6e782f602c6daa8f852bfcb5c893d3f6..aa4d9bb4ada1869788c8184b560ba03c0951d267 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ *.hex *.bin *~ +*.d \ No newline at end of file diff --git a/Makefile b/Makefile index 6c8092c395ce60ea16c806f71d2a1011ae067d4a..3e615d0e76d932f2d05158f3a552b89e84039252 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ CFLAGS := $(CFLAGS_BASE) -I. -Imiosix -Imiosix/arch/common \ -Imiosix/$(ARCH_INC) -Imiosix/$(BOARD_INC) $(INCLUDE_DIRS) AFLAGS := $(AFLAGS_BASE) LFLAGS := $(LFLAGS_BASE) +DFLAGS := -MM LINK_LIBS := $(LIBS) -L./miosix -Wl,--start-group -lmiosix -lstdc++ -lc -lm \ -lgcc -Wl,--end-group @@ -62,7 +63,7 @@ clean-recursive: done clean-topdir: - -rm $(OBJ) main.elf main.hex main.bin main.map + -rm $(OBJ) main.elf main.hex main.bin main.map *.d main: main.elf $(CP) -O ihex main.elf main.hex @@ -73,11 +74,16 @@ main.elf: $(OBJ) miosix/libmiosix.a @ echo "linking" $(CXX) $(LFLAGS) -o main.elf $(OBJ) miosix/$(BOOT_FILE) $(LINK_LIBS) +#pull in dependecy info for existing .o files +-include $(OBJ:.o=.d) + %.o: %.s $(AS) $(AFLAGS) $< -o $@ %.o : %.c $(CC) $(CFLAGS) $< -o $@ + $(CC) $(DFLAGS) $(CFLAGS) $*.c > $*.d %.o : %.cpp - $(CXX) $(CXXFLAGS) $< -o $@ + $(CXX) $(CXXFLAGS) $< -o $@ + $(CXX) $(DFLAGS) $(CXXFLAGS) $*.cpp > $*.d diff --git a/app_template/Makefile b/app_template/Makefile index 14f8b29d11820b79efb13631c61830dbc2a6b49f..035a97ad9e5034036b5f9c0903fa3acf58d56f2b 100644 --- a/app_template/Makefile +++ b/app_template/Makefile @@ -21,6 +21,7 @@ CXXFLAGS := $(CFLAGS) LFLAGS := -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base \ -Wl,--gc-sections,-Map,main.map,-T./miosix.ld,-n,-pie,--spare-dynamic-tags,3 \ -O2 -nostdlib +DFLAGS := -MM LINK_LIBS := -Wl,--start-group -lstdc++ -lc -lm -lgcc -Wl,--end-group @@ -32,13 +33,18 @@ all: $(OBJ) crt0.o @xxd -i main.elf | sed 's/unsigned char/const unsigned char __attribute__((aligned(8)))/' > prog3.h clean: - -rm $(OBJ) crt0.o main.elf main.map main.txt + -rm $(OBJ) crt0.o main.elf main.map main.txt *.d + +#pull in dependecy info for existing .o files +-include $(OBJ:.o=.d) %.o: %.s $(AS) $(AFLAGS) $< -o $@ %.o : %.c $(CC) $(CFLAGS) $< -o $@ + $(CC) $(DFLAGS) $(CFLAGS) $*.c > $*.d %.o : %.cpp $(CXX) $(CXXFLAGS) $< -o $@ + $(CXX) $(DFLAGS) $(CXXFLAGS) $*.cpp > $*.d \ No newline at end of file diff --git a/app_template/main.map b/app_template/main.map deleted file mode 100644 index afa768b2b238393973539c34be5672d297a6292a..0000000000000000000000000000000000000000 --- a/app_template/main.map +++ /dev/null @@ -1,139 +0,0 @@ - -Discarded input sections - - .text 0x0000000000000000 0x0 main.o - .data 0x0000000000000000 0x0 main.o - .bss 0x0000000000000000 0x0 main.o - .text.mystrlen - 0x0000000000000000 0x14 main.o - .comment 0x0000000000000000 0x12 main.o - .ARM.attributes - 0x0000000000000000 0x31 main.o - .data 0x0000000000000000 0x0 crt0.o - .bss 0x0000000000000000 0x0 crt0.o - .ARM.attributes - 0x0000000000000000 0x21 crt0.o - -Memory Configuration - -Name Origin Length Attributes -*default* 0x0000000000000000 0xffffffffffffffff - -Linker script and memory map - - 0x0000000000000094 . = (0x0 + SIZEOF_HEADERS) - -.text 0x0000000000000098 0x202 - *(.text) - .text 0x0000000000000098 0x8 crt0.o - 0x0000000000000098 _start - *(.text.*) - .text.main 0x00000000000000a0 0x1cc main.o - 0x00000000000000a0 main - .text._exit 0x000000000000026c 0x4 crt0.o - 0x000000000000026c _exit - .text.open 0x0000000000000270 0x6 crt0.o - 0x0000000000000270 open - .text.close 0x0000000000000276 0x6 crt0.o - 0x0000000000000276 close - .text.seek 0x000000000000027c 0x6 crt0.o - 0x000000000000027c seek - .text.system 0x0000000000000282 0x6 crt0.o - 0x0000000000000282 system - .text.write 0x0000000000000288 0x6 crt0.o - 0x0000000000000288 write - .text.read 0x000000000000028e 0x6 crt0.o - 0x000000000000028e read - .text.usleep 0x0000000000000294 0x6 crt0.o - 0x0000000000000294 usleep - *(.gnu.linkonce.t.*) - -.glue_7 0x000000000000029c 0x0 - .glue_7 0x0000000000000000 0x0 linker stubs - -.glue_7t 0x000000000000029c 0x0 - .glue_7t 0x0000000000000000 0x0 linker stubs - -.vfp11_veneer 0x000000000000029c 0x0 - .vfp11_veneer 0x0000000000000000 0x0 linker stubs - -.v4_bx 0x000000000000029c 0x0 - .v4_bx 0x0000000000000000 0x0 linker stubs - -.plt 0x000000000000029c 0x0 - .plt 0x0000000000000000 0x0 main.o - -.rel.dyn 0x000000000000029c 0x0 - .rel.plt 0x0000000000000000 0x0 main.o - -.rel.data - *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) - -.rel.got 0x000000000000029c 0x0 - *(.rel.got) - .rel.got 0x0000000000000000 0x0 main.o - 0x0000000010000000 . = 0x10000000 - -.got 0x0000000010000000 0xc - *(.got.plt) - .got.plt 0x0000000010000000 0xc main.o - 0x0000000010000000 _GLOBAL_OFFSET_TABLE_ - *(.igot.plt) - *(.got) - .got 0x0000000000000000 0x0 main.o - *(.igot) - -.dynamic 0x000000001000000c 0x28 - *(.dynamic) - .dynamic 0x000000001000000c 0x28 main.o - 0x000000001000000c _DYNAMIC - -.rodata 0x0000000010000038 0xd8 - *(.rodata) - .rodata 0x0000000010000038 0x84 main.o - *(.rodata.*) - .rodata.str1.4 - 0x00000000100000bc 0x54 main.o - *(.gnu.linkonce.r.*) - -.gnu.version_d 0x0000000010000110 0x0 - .gnu.version_d - 0x0000000000000000 0x0 main.o - -.gnu.version 0x0000000010000110 0x0 - .gnu.version 0x0000000000000000 0x0 main.o - -.gnu.version_r 0x0000000010000110 0x0 - .gnu.version_r - 0x0000000000000000 0x0 main.o - -.data - *(.data) - *(.data.*) - *(.gnu.linkonce.d.*) - -.bss - *(.bss) - *(.bss.*) - *(.gnu.linkonce.b.*) - *(COMMON) - -.dynbss 0x0000000010000110 0x0 - .dynbss 0x0000000000000000 0x0 main.o - -/DISCARD/ - *(.interp) - *(.dynsym) - *(.dynstr) - *(.hash) - *(.comment) - *(.ARM.attributes) -LOAD main.o -LOAD crt0.o -START GROUP -LOAD /opt/arm-miosix-eabi/lib/gcc/arm-eabi/4.5.2/../../../../arm-eabi/lib/thumb/thumb2/libstdc++.a -LOAD /opt/arm-miosix-eabi/lib/gcc/arm-eabi/4.5.2/../../../../arm-eabi/lib/thumb/thumb2/libc.a -LOAD /opt/arm-miosix-eabi/lib/gcc/arm-eabi/4.5.2/../../../../arm-eabi/lib/thumb/thumb2/libm.a -LOAD /opt/arm-miosix-eabi/lib/gcc/arm-eabi/4.5.2/thumb/thumb2/libgcc.a -END GROUP -OUTPUT(main.elf elf32-littlearm) diff --git a/app_template/main.txt b/app_template/main.txt deleted file mode 100644 index 5bf9c42c2560b1a39ea681f2e7d64bd2be9e2f04..0000000000000000000000000000000000000000 --- a/app_template/main.txt +++ /dev/null @@ -1,411 +0,0 @@ - -main.elf: file format elf32-littlearm -main.elf -architecture: arm, flags 0x00000050: -HAS_SYMS, DYNAMIC -start address 0x00000099 - -Program Header: - LOAD off 0x00000098 vaddr 0x00000098 paddr 0x00000098 align 2**3 - filesz 0x00000202 memsz 0x00000202 flags r-x - LOAD off 0x000002a0 vaddr 0x10000000 paddr 0x10000000 align 2**3 - filesz 0x00000110 memsz 0x00000110 flags rw- - DYNAMIC off 0x000002ac vaddr 0x1000000c paddr 0x1000000c align 2**2 - filesz 0x00000028 memsz 0x00000028 flags rw- - -Dynamic Section: - DEBUG 0x00000000 -private flags = 5000002: [Version5 EABI] [has entry point] - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 00000202 00000098 00000098 00000098 2**3 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .got 0000000c 10000000 10000000 000002a0 2**2 - CONTENTS, ALLOC, LOAD, DATA - 2 .dynamic 00000028 1000000c 1000000c 000002ac 2**2 - CONTENTS, ALLOC, LOAD, DATA - 3 .rodata 000000d8 10000038 10000038 000002d8 2**3 - CONTENTS, ALLOC, LOAD, READONLY, DATA -SYMBOL TABLE: -00000098 l d .text 00000000 .text -10000000 l d .got 00000000 .got -1000000c l d .dynamic 00000000 .dynamic -10000038 l d .rodata 00000000 .rodata -00000000 l df *ABS* 00000000 main.c -10000038 l O .rodata 00000051 str.3095 -1000008c l O .rodata 0000001b okMsg.3097 -100000a8 l O .rodata 00000014 str2.3096 -1000000c l O *ABS* 00000000 _DYNAMIC -10000000 l O *ABS* 00000000 _GLOBAL_OFFSET_TABLE_ -00000294 g F .text 00000000 usleep -00000282 g F .text 00000000 system -00000288 g F .text 00000000 write -00000098 g F .text 00000000 _start -0000028e g F .text 00000000 read -000000a0 g F .text 000001cc main -0000027c g F .text 00000000 seek -0000026c g F .text 00000000 _exit -00000270 g F .text 00000000 open -00000276 g F .text 00000000 close - - -Contents of section .text: - 0098 00f002f8 00f0e6f8 2de9f04d 9cb00022 ........-..M..." - 00a8 1cab43f8 042ddff8 9881664f dff898a1 ..C..-....fO.... - 00b8 dff898b1 a3f50c63 654d43f8 1c2c02ae .......ceMC..,.. - 00c8 c8444f44 ca44cb44 09eb0503 002213f8 .DOD.D.D.....".. - 00d8 014f0132 002cfad1 09eb0501 012000f0 .O.2.,....... .. - 00e8 cff86422 20463146 00f0cdf8 0028ebdd ..d" F1F.....(.. - 00f8 9df80830 303b062b 74d8dfe8 03f06c65 ...00;.+t.....le - 0108 615f5908 04004046 00f0b7f8 dce73846 a_Y...@F......8F - 0118 40f20241 002200f0 a7f80446 0028d3d0 @..A.".....F.(.. - 0128 0c220120 514600f0 abf80422 20465946 .". QF....." FYF - 0138 00f0a6f8 042870d0 00210191 00210a46 .....(p..!...!.F - 0148 204600f0 97f84349 03222046 494400f0 F....CI." FID.. - 0158 97f80328 6ad00022 11462046 00f08af8 ...(j..".F F.... - 0168 64222046 314600f0 8ef80428 4ad02046 d" F1F.....(J. F - 0178 00f07df8 04460028 a6d13749 01204944 ..}..F.(..7I. ID - 0188 092200f0 7df80199 41f00403 072b9bd1 ."..}...A....+.. - 0198 09eb0503 54332246 13f8011f 01320029 ....T3"F.....2.) - 01a8 fad109eb 05015431 012000f0 69f88be7 ......T1. ..i... - 01b8 4ff04043 186800f0 69f885e7 00be83e7 O.@C.h..i....... - 01c8 00201cb0 bde8f08d 44f64030 c0f24c00 . ......D.@0..L. - 01d8 00f05cf8 78e70023 0a2090fb f3f000f0 ..\.x..#. ...... - 01e8 55f871e7 09eb0503 70330022 13f8011f U.q.....p3.".... - 01f8 01320029 fad109eb 05017031 012000f0 .2.)......p1. .. - 0208 3ff861e7 15490120 49440822 00f038f8 ?.a..I. ID."..8. - 0218 019b43f0 02030193 a9e71149 01204944 ..C........I. ID - 0228 092200f0 2df80123 019387e7 0c490922 ."..-..#.....I." - 0238 01204944 00f024f8 01220192 8be700bf . ID..$.."...... - 0248 08010000 bc000000 c8000000 d8000000 ................ - 0258 38000000 ec000000 fc000000 f0000000 8............... - 0268 e0000000 022300df 062300df 70470723 .....#...#..pG.# - 0278 00df7047 082300df 70470923 00df7047 ..pG.#..pG.#..pG - 0288 032300df 70470423 00df7047 052300df .#..pG.#..pG.#.. - 0298 7047 pG -Contents of section .got: - 10000000 0c000010 00000000 00000000 ............ -Contents of section .dynamic: - 1000000c 15000000 00000000 00000000 00000000 ................ - 1000001c 00000000 00000000 00000000 00000000 ................ - 1000002c 00000000 00000000 ........ -Contents of section .rodata: - 10000038 54657374 20617070 6c696361 74696f6e Test application - 10000048 3a0a303d 6469767a 65726f0a 313d736c :.0=divzero.1=sl - 10000058 65657020 35730a32 3d657869 740a333d eep 5s.2=exit.3= - 10000068 626b7074 0a343d64 616e676c 696e670a bkpt.4=dangling. - 10000078 353d6f70 656e0a36 3d737973 74656d0a 5=open.6=system. - 10000088 00000000 45766572 79746869 6e672773 ....Everything's - 10000098 20736869 6e792c20 43617027 6e0a0000 shiny, Cap'n... - 100000a8 556e6578 70656374 65642063 6f6d6d61 Unexpected comma - 100000b8 6e640a00 2f746573 742e7478 74000000 nd../test.txt... - 100000c8 46696c65 206f7065 6e65640a 00000000 File opened..... - 100000d8 6369616f 00000000 57726974 65206f6b ciao....Write ok - 100000e8 0a000000 31323300 52656164 206f6b0a ....123.Read ok. - 100000f8 00000000 436c6f73 65206f6b 0a000000 ....Close ok.... - 10000108 74657374 00000000 test.... - -Disassembly of section .text: - -00000098 <_start>: -_start(): - 98: f000 f802 bl a0 <main> - 9c: f000 f8e6 bl 26c <_exit> - -000000a0 <main>: -main(): - a0: e92d 4df0 stmdb sp!, {r4, r5, r6, r7, r8, sl, fp, lr} - a4: b09c sub sp, #112 ; 0x70 - a6: 2200 movs r2, #0 - a8: ab1c add r3, sp, #112 ; 0x70 - aa: f843 2d04 str.w r2, [r3, #-4]! - ae: f8df 8198 ldr.w r8, [pc, #408] ; 248 <main+0x1a8> - b2: 4f66 ldr r7, [pc, #408] ; (24c <main+0x1ac>) - b4: f8df a198 ldr.w sl, [pc, #408] ; 250 <main+0x1b0> - b8: f8df b198 ldr.w fp, [pc, #408] ; 254 <main+0x1b4> - bc: f5a3 630c sub.w r3, r3, #2240 ; 0x8c0 - c0: 4d65 ldr r5, [pc, #404] ; (258 <main+0x1b8>) - c2: f843 2c1c str.w r2, [r3, #-28] - c6: ae02 add r6, sp, #8 - c8: 44c8 add r8, r9 - ca: 444f add r7, r9 - cc: 44ca add sl, r9 - ce: 44cb add fp, r9 - d0: eb09 0305 add.w r3, r9, r5 - d4: 2200 movs r2, #0 - d6: f813 4f01 ldrb.w r4, [r3, #1]! - da: 3201 adds r2, #1 - dc: 2c00 cmp r4, #0 - de: d1fa bne.n d6 <main+0x36> - e0: eb09 0105 add.w r1, r9, r5 - e4: 2001 movs r0, #1 - e6: f000 f8cf bl 288 <write> - ea: 2264 movs r2, #100 ; 0x64 - ec: 4620 mov r0, r4 - ee: 4631 mov r1, r6 - f0: f000 f8cd bl 28e <read> - f4: 2800 cmp r0, #0 - f6: ddeb ble.n d0 <main+0x30> - f8: f89d 3008 ldrb.w r3, [sp, #8] - fc: 3b30 subs r3, #48 ; 0x30 - fe: 2b06 cmp r3, #6 - 100: d874 bhi.n 1ec <main+0x14c> - 102: e8df f003 tbb [pc, r3] - 106: 5f61656c svcpl 0x0061656c - 10a: 00040859 andeq r0, r4, r9, asr r8 - 10e: 4640 mov r0, r8 - 110: f000 f8b7 bl 282 <system> - 114: e7dc b.n d0 <main+0x30> - 116: 4638 mov r0, r7 - 118: f240 4102 movw r1, #1026 ; 0x402 - 11c: 2200 movs r2, #0 - 11e: f000 f8a7 bl 270 <open> - 122: 4604 mov r4, r0 - 124: 2800 cmp r0, #0 - 126: d0d3 beq.n d0 <main+0x30> - 128: 220c movs r2, #12 - 12a: 2001 movs r0, #1 - 12c: 4651 mov r1, sl - 12e: f000 f8ab bl 288 <write> - 132: 2204 movs r2, #4 - 134: 4620 mov r0, r4 - 136: 4659 mov r1, fp - 138: f000 f8a6 bl 288 <write> - 13c: 2804 cmp r0, #4 - 13e: d070 beq.n 222 <main+0x182> - 140: 2100 movs r1, #0 - 142: 9101 str r1, [sp, #4] - 144: 2100 movs r1, #0 - 146: 460a mov r2, r1 - 148: 4620 mov r0, r4 - 14a: f000 f897 bl 27c <seek> - 14e: 4943 ldr r1, [pc, #268] ; (25c <main+0x1bc>) - 150: 2203 movs r2, #3 - 152: 4620 mov r0, r4 - 154: 4449 add r1, r9 - 156: f000 f897 bl 288 <write> - 15a: 2803 cmp r0, #3 - 15c: d06a beq.n 234 <main+0x194> - 15e: 2200 movs r2, #0 - 160: 4611 mov r1, r2 - 162: 4620 mov r0, r4 - 164: f000 f88a bl 27c <seek> - 168: 2264 movs r2, #100 ; 0x64 - 16a: 4620 mov r0, r4 - 16c: 4631 mov r1, r6 - 16e: f000 f88e bl 28e <read> - 172: 2804 cmp r0, #4 - 174: d04a beq.n 20c <main+0x16c> - 176: 4620 mov r0, r4 - 178: f000 f87d bl 276 <close> - 17c: 4604 mov r4, r0 - 17e: 2800 cmp r0, #0 - 180: d1a6 bne.n d0 <main+0x30> - 182: 4937 ldr r1, [pc, #220] ; (260 <main+0x1c0>) - 184: 2001 movs r0, #1 - 186: 4449 add r1, r9 - 188: 2209 movs r2, #9 - 18a: f000 f87d bl 288 <write> - 18e: 9901 ldr r1, [sp, #4] - 190: f041 0304 orr.w r3, r1, #4 - 194: 2b07 cmp r3, #7 - 196: d19b bne.n d0 <main+0x30> - 198: eb09 0305 add.w r3, r9, r5 - 19c: 3354 adds r3, #84 ; 0x54 - 19e: 4622 mov r2, r4 - 1a0: f813 1f01 ldrb.w r1, [r3, #1]! - 1a4: 3201 adds r2, #1 - 1a6: 2900 cmp r1, #0 - 1a8: d1fa bne.n 1a0 <main+0x100> - 1aa: eb09 0105 add.w r1, r9, r5 - 1ae: 3154 adds r1, #84 ; 0x54 - 1b0: 2001 movs r0, #1 - 1b2: f000 f869 bl 288 <write> - 1b6: e78b b.n d0 <main+0x30> - 1b8: f04f 4340 mov.w r3, #3221225472 ; 0xc0000000 - 1bc: 6818 ldr r0, [r3, #0] - 1be: f000 f869 bl 294 <usleep> - 1c2: e785 b.n d0 <main+0x30> - 1c4: be00 bkpt 0x0000 - 1c6: e783 b.n d0 <main+0x30> - 1c8: 2000 movs r0, #0 - 1ca: b01c add sp, #112 ; 0x70 - 1cc: e8bd 8df0 ldmia.w sp!, {r4, r5, r6, r7, r8, sl, fp, pc} - 1d0: f644 3040 movw r0, #19264 ; 0x4b40 - 1d4: f2c0 004c movt r0, #76 ; 0x4c - 1d8: f000 f85c bl 294 <usleep> - 1dc: e778 b.n d0 <main+0x30> - 1de: 2300 movs r3, #0 - 1e0: 200a movs r0, #10 - 1e2: fb90 f0f3 sdiv r0, r0, r3 - 1e6: f000 f855 bl 294 <usleep> - 1ea: e771 b.n d0 <main+0x30> - 1ec: eb09 0305 add.w r3, r9, r5 - 1f0: 3370 adds r3, #112 ; 0x70 - 1f2: 2200 movs r2, #0 - 1f4: f813 1f01 ldrb.w r1, [r3, #1]! - 1f8: 3201 adds r2, #1 - 1fa: 2900 cmp r1, #0 - 1fc: d1fa bne.n 1f4 <main+0x154> - 1fe: eb09 0105 add.w r1, r9, r5 - 202: 3170 adds r1, #112 ; 0x70 - 204: 2001 movs r0, #1 - 206: f000 f83f bl 288 <write> - 20a: e761 b.n d0 <main+0x30> - 20c: 4915 ldr r1, [pc, #84] ; (264 <main+0x1c4>) - 20e: 2001 movs r0, #1 - 210: 4449 add r1, r9 - 212: 2208 movs r2, #8 - 214: f000 f838 bl 288 <write> - 218: 9b01 ldr r3, [sp, #4] - 21a: f043 0302 orr.w r3, r3, #2 - 21e: 9301 str r3, [sp, #4] - 220: e7a9 b.n 176 <main+0xd6> - 222: 4911 ldr r1, [pc, #68] ; (268 <main+0x1c8>) - 224: 2001 movs r0, #1 - 226: 4449 add r1, r9 - 228: 2209 movs r2, #9 - 22a: f000 f82d bl 288 <write> - 22e: 2301 movs r3, #1 - 230: 9301 str r3, [sp, #4] - 232: e787 b.n 144 <main+0xa4> - 234: 490c ldr r1, [pc, #48] ; (268 <main+0x1c8>) - 236: 2209 movs r2, #9 - 238: 2001 movs r0, #1 - 23a: 4449 add r1, r9 - 23c: f000 f824 bl 288 <write> - 240: 2201 movs r2, #1 - 242: 9201 str r2, [sp, #4] - 244: e78b b.n 15e <main+0xbe> - 246: bf00 nop - 248: 00000108 andeq r0, r0, r8, lsl #2 - 24c: 000000bc strheq r0, [r0], -ip - 250: 000000c8 andeq r0, r0, r8, asr #1 - 254: 000000d8 ldrdeq r0, [r0], -r8 - 258: 00000038 andeq r0, r0, r8, lsr r0 - 25c: 000000ec andeq r0, r0, ip, ror #1 - 260: 000000fc strdeq r0, [r0], -ip - 264: 000000f0 strdeq r0, [r0], -r0 ; <UNPREDICTABLE> - 268: 000000e0 andeq r0, r0, r0, ror #1 - -0000026c <_exit>: -_exit(): - 26c: 2302 movs r3, #2 - 26e: df00 svc 0 - -00000270 <open>: -open(): - 270: 2306 movs r3, #6 - 272: df00 svc 0 - 274: 4770 bx lr - -00000276 <close>: -close(): - 276: 2307 movs r3, #7 - 278: df00 svc 0 - 27a: 4770 bx lr - -0000027c <seek>: -seek(): - 27c: 2308 movs r3, #8 - 27e: df00 svc 0 - 280: 4770 bx lr - -00000282 <system>: -system(): - 282: 2309 movs r3, #9 - 284: df00 svc 0 - 286: 4770 bx lr - -00000288 <write>: -write(): - 288: 2303 movs r3, #3 - 28a: df00 svc 0 - 28c: 4770 bx lr - -0000028e <read>: -read(): - 28e: 2304 movs r3, #4 - 290: df00 svc 0 - 292: 4770 bx lr - -00000294 <usleep>: -usleep(): - 294: 2305 movs r3, #5 - 296: df00 svc 0 - 298: 4770 bx lr - -Disassembly of section .got: - -10000000 <.got>: -10000000: 1000000c andne r0, r0, ip - ... - -Disassembly of section .dynamic: - -1000000c <.dynamic>: -1000000c: 00000015 andeq r0, r0, r5, lsl r0 - ... - -Disassembly of section .rodata: - -10000038 <str.3095>: -10000038: 74736554 ldrbtvc r6, [r3], #-1364 ; 0x554 -1000003c: 70706120 rsbsvc r6, r0, r0, lsr #2 -10000040: 6163696c cmnvs r3, ip, ror #18 -10000044: 6e6f6974 mcrvs 9, 3, r6, cr15, cr4, {3} -10000048: 3d300a3a vldmdbcc r0!, {s0-s57} -1000004c: 7a766964 bvc 11d9a5e4 <str2.3096+0x1d9a53c> -10000050: 0a6f7265 beq 11bdc9ec <str2.3096+0x1bdc944> -10000054: 6c733d31 ldclvs 13, cr3, [r3], #-196 ; 0xffffff3c -10000058: 20706565 rsbscs r6, r0, r5, ror #10 -1000005c: 320a7335 andcc r7, sl, #-738197504 ; 0xd4000000 -10000060: 6978653d ldmdbvs r8!, {r0, r2, r3, r4, r5, r8, sl, sp, lr}^ -10000064: 3d330a74 vldmdbcc r3!, {s0-s115} -10000068: 74706b62 ldrbtvc r6, [r0], #-2914 ; 0xb62 -1000006c: 643d340a ldrtvs r3, [sp], #-1034 ; 0x40a -10000070: 6c676e61 stclvs 14, cr6, [r7], #-388 ; 0xfffffe7c -10000074: 0a676e69 beq 119dba20 <str2.3096+0x19db978> -10000078: 706f3d35 rsbvc r3, pc, r5, lsr sp ; <UNPREDICTABLE> -1000007c: 360a6e65 strcc r6, [sl], -r5, ror #28 -10000080: 7379733d cmnvc r9, #-201326592 ; 0xf4000000 -10000084: 0a6d6574 beq 11b5965c <str2.3096+0x1b595b4> -10000088: 00000000 andeq r0, r0, r0 - -1000008c <okMsg.3097>: -1000008c: 72657645 rsbvc r7, r5, #72351744 ; 0x4500000 -10000090: 69687479 stmdbvs r8!, {r0, r3, r4, r5, r6, sl, ip, sp, lr}^ -10000094: 7327676e teqvc r7, #28835840 ; 0x1b80000 -10000098: 69687320 stmdbvs r8!, {r5, r8, r9, ip, sp, lr}^ -1000009c: 202c796e eorcs r7, ip, lr, ror #18 -100000a0: 27706143 ldrbcs r6, [r0, -r3, asr #2]! -100000a4: 00000a6e andeq r0, r0, lr, ror #20 - -100000a8 <str2.3096>: -100000a8: 78656e55 stmdavc r5!, {r0, r2, r4, r6, r9, sl, fp, sp, lr}^ -100000ac: 74636570 strbtvc r6, [r3], #-1392 ; 0x570 -100000b0: 63206465 teqvs r0, #1694498816 ; 0x65000000 -100000b4: 616d6d6f cmnvs sp, pc, ror #26 -100000b8: 000a646e andeq r6, sl, lr, ror #8 -100000bc: 7365742f cmnvc r5, #788529152 ; 0x2f000000 -100000c0: 78742e74 ldmdavc r4!, {r2, r4, r5, r6, r9, sl, fp, sp}^ -100000c4: 00000074 andeq r0, r0, r4, ror r0 -100000c8: 656c6946 strbvs r6, [ip, #-2374]! ; 0x946 -100000cc: 65706f20 ldrbvs r6, [r0, #-3872]! ; 0xf20 -100000d0: 0a64656e beq 11919690 <str2.3096+0x19195e8> -100000d4: 00000000 andeq r0, r0, r0 -100000d8: 6f616963 svcvs 0x00616963 -100000dc: 00000000 andeq r0, r0, r0 -100000e0: 74697257 strbtvc r7, [r9], #-599 ; 0x257 -100000e4: 6b6f2065 blvs 11bc8280 <str2.3096+0x1bc81d8> -100000e8: 0000000a andeq r0, r0, sl -100000ec: 00333231 eorseq r3, r3, r1, lsr r2 -100000f0: 64616552 strbtvs r6, [r1], #-1362 ; 0x552 -100000f4: 0a6b6f20 beq 11adbd7c <str2.3096+0x1adbcd4> -100000f8: 00000000 andeq r0, r0, r0 -100000fc: 736f6c43 cmnvc pc, #17152 ; 0x4300 -10000100: 6b6f2065 blvs 11bc829c <str2.3096+0x1bc81f4> -10000104: 0000000a andeq r0, r0, sl -10000108: 74736574 ldrbtvc r6, [r3], #-1396 ; 0x574 -1000010c: 00000000 andeq r0, r0, r0 diff --git a/app_template/prog3.h b/app_template/prog3.h deleted file mode 100644 index 83517f48c538b91d68d16fdb58bbd1d76fb67e91..0000000000000000000000000000000000000000 --- a/app_template/prog3.h +++ /dev/null @@ -1,82 +0,0 @@ -const unsigned char __attribute__((aligned(8))) main_elf[] = { - 0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x99, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, - 0x98, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, - 0x02, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, - 0x00, 0x00, 0x00, 0x10, 0x10, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0xac, 0x02, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10, - 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x02, 0xf8, - 0x00, 0xf0, 0xe6, 0xf8, 0x2d, 0xe9, 0xf0, 0x4d, 0x9c, 0xb0, 0x00, 0x22, - 0x1c, 0xab, 0x43, 0xf8, 0x04, 0x2d, 0xdf, 0xf8, 0x98, 0x81, 0x66, 0x4f, - 0xdf, 0xf8, 0x98, 0xa1, 0xdf, 0xf8, 0x98, 0xb1, 0xa3, 0xf5, 0x0c, 0x63, - 0x65, 0x4d, 0x43, 0xf8, 0x1c, 0x2c, 0x02, 0xae, 0xc8, 0x44, 0x4f, 0x44, - 0xca, 0x44, 0xcb, 0x44, 0x09, 0xeb, 0x05, 0x03, 0x00, 0x22, 0x13, 0xf8, - 0x01, 0x4f, 0x01, 0x32, 0x00, 0x2c, 0xfa, 0xd1, 0x09, 0xeb, 0x05, 0x01, - 0x01, 0x20, 0x00, 0xf0, 0xcf, 0xf8, 0x64, 0x22, 0x20, 0x46, 0x31, 0x46, - 0x00, 0xf0, 0xcd, 0xf8, 0x00, 0x28, 0xeb, 0xdd, 0x9d, 0xf8, 0x08, 0x30, - 0x30, 0x3b, 0x06, 0x2b, 0x74, 0xd8, 0xdf, 0xe8, 0x03, 0xf0, 0x6c, 0x65, - 0x61, 0x5f, 0x59, 0x08, 0x04, 0x00, 0x40, 0x46, 0x00, 0xf0, 0xb7, 0xf8, - 0xdc, 0xe7, 0x38, 0x46, 0x40, 0xf2, 0x02, 0x41, 0x00, 0x22, 0x00, 0xf0, - 0xa7, 0xf8, 0x04, 0x46, 0x00, 0x28, 0xd3, 0xd0, 0x0c, 0x22, 0x01, 0x20, - 0x51, 0x46, 0x00, 0xf0, 0xab, 0xf8, 0x04, 0x22, 0x20, 0x46, 0x59, 0x46, - 0x00, 0xf0, 0xa6, 0xf8, 0x04, 0x28, 0x70, 0xd0, 0x00, 0x21, 0x01, 0x91, - 0x00, 0x21, 0x0a, 0x46, 0x20, 0x46, 0x00, 0xf0, 0x97, 0xf8, 0x43, 0x49, - 0x03, 0x22, 0x20, 0x46, 0x49, 0x44, 0x00, 0xf0, 0x97, 0xf8, 0x03, 0x28, - 0x6a, 0xd0, 0x00, 0x22, 0x11, 0x46, 0x20, 0x46, 0x00, 0xf0, 0x8a, 0xf8, - 0x64, 0x22, 0x20, 0x46, 0x31, 0x46, 0x00, 0xf0, 0x8e, 0xf8, 0x04, 0x28, - 0x4a, 0xd0, 0x20, 0x46, 0x00, 0xf0, 0x7d, 0xf8, 0x04, 0x46, 0x00, 0x28, - 0xa6, 0xd1, 0x37, 0x49, 0x01, 0x20, 0x49, 0x44, 0x09, 0x22, 0x00, 0xf0, - 0x7d, 0xf8, 0x01, 0x99, 0x41, 0xf0, 0x04, 0x03, 0x07, 0x2b, 0x9b, 0xd1, - 0x09, 0xeb, 0x05, 0x03, 0x54, 0x33, 0x22, 0x46, 0x13, 0xf8, 0x01, 0x1f, - 0x01, 0x32, 0x00, 0x29, 0xfa, 0xd1, 0x09, 0xeb, 0x05, 0x01, 0x54, 0x31, - 0x01, 0x20, 0x00, 0xf0, 0x69, 0xf8, 0x8b, 0xe7, 0x4f, 0xf0, 0x40, 0x43, - 0x18, 0x68, 0x00, 0xf0, 0x69, 0xf8, 0x85, 0xe7, 0x00, 0xbe, 0x83, 0xe7, - 0x00, 0x20, 0x1c, 0xb0, 0xbd, 0xe8, 0xf0, 0x8d, 0x44, 0xf6, 0x40, 0x30, - 0xc0, 0xf2, 0x4c, 0x00, 0x00, 0xf0, 0x5c, 0xf8, 0x78, 0xe7, 0x00, 0x23, - 0x0a, 0x20, 0x90, 0xfb, 0xf3, 0xf0, 0x00, 0xf0, 0x55, 0xf8, 0x71, 0xe7, - 0x09, 0xeb, 0x05, 0x03, 0x70, 0x33, 0x00, 0x22, 0x13, 0xf8, 0x01, 0x1f, - 0x01, 0x32, 0x00, 0x29, 0xfa, 0xd1, 0x09, 0xeb, 0x05, 0x01, 0x70, 0x31, - 0x01, 0x20, 0x00, 0xf0, 0x3f, 0xf8, 0x61, 0xe7, 0x15, 0x49, 0x01, 0x20, - 0x49, 0x44, 0x08, 0x22, 0x00, 0xf0, 0x38, 0xf8, 0x01, 0x9b, 0x43, 0xf0, - 0x02, 0x03, 0x01, 0x93, 0xa9, 0xe7, 0x11, 0x49, 0x01, 0x20, 0x49, 0x44, - 0x09, 0x22, 0x00, 0xf0, 0x2d, 0xf8, 0x01, 0x23, 0x01, 0x93, 0x87, 0xe7, - 0x0c, 0x49, 0x09, 0x22, 0x01, 0x20, 0x49, 0x44, 0x00, 0xf0, 0x24, 0xf8, - 0x01, 0x22, 0x01, 0x92, 0x8b, 0xe7, 0x00, 0xbf, 0x08, 0x01, 0x00, 0x00, - 0xbc, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, - 0x38, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x23, 0x00, 0xdf, - 0x06, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x07, 0x23, 0x00, 0xdf, 0x70, 0x47, - 0x08, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x09, 0x23, 0x00, 0xdf, 0x70, 0x47, - 0x03, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x04, 0x23, 0x00, 0xdf, 0x70, 0x47, - 0x05, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, - 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, - 0x4d, 0x69, 0x6f, 0x73, 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x65, 0x73, 0x74, - 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x3a, 0x0a, 0x30, 0x3d, 0x64, 0x69, 0x76, 0x7a, 0x65, 0x72, 0x6f, 0x0a, - 0x31, 0x3d, 0x73, 0x6c, 0x65, 0x65, 0x70, 0x20, 0x35, 0x73, 0x0a, 0x32, - 0x3d, 0x65, 0x78, 0x69, 0x74, 0x0a, 0x33, 0x3d, 0x62, 0x6b, 0x70, 0x74, - 0x0a, 0x34, 0x3d, 0x64, 0x61, 0x6e, 0x67, 0x6c, 0x69, 0x6e, 0x67, 0x0a, - 0x35, 0x3d, 0x6f, 0x70, 0x65, 0x6e, 0x0a, 0x36, 0x3d, 0x73, 0x79, 0x73, - 0x74, 0x65, 0x6d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x45, 0x76, 0x65, 0x72, - 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x27, 0x73, 0x20, 0x73, 0x68, 0x69, - 0x6e, 0x79, 0x2c, 0x20, 0x43, 0x61, 0x70, 0x27, 0x6e, 0x0a, 0x00, 0x00, - 0x55, 0x6e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x20, 0x63, - 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x0a, 0x00, 0x2f, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x46, 0x69, 0x6c, 0x65, - 0x20, 0x6f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x0a, 0x00, 0x00, 0x00, 0x00, - 0x63, 0x69, 0x61, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x57, 0x72, 0x69, 0x74, - 0x65, 0x20, 0x6f, 0x6b, 0x0a, 0x00, 0x00, 0x00, 0x31, 0x32, 0x33, 0x00, - 0x52, 0x65, 0x61, 0x64, 0x20, 0x6f, 0x6b, 0x0a, 0x00, 0x00, 0x00, 0x00, - 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x20, 0x6f, 0x6b, 0x0a, 0x00, 0x00, 0x00, - 0x74, 0x65, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00 -}; -unsigned int main_elf_len = 944; diff --git a/app_template_withlibs/Makefile b/app_template_withlibs/Makefile index 81a35d4c204aaaa17caec941efa6dd4cc3697b6e..6d6bad5fe21847a0c38f8fd1b757511ae0680bba 100644 --- a/app_template_withlibs/Makefile +++ b/app_template_withlibs/Makefile @@ -22,6 +22,8 @@ CXXFLAGS := $(CFLAGS) LFLAGS := -mcpu=cortex-m3 -mthumb -fpie -msingle-pic-base \ -Wl,--gc-sections,-Map,main.map,-T./miosix.ld,-n,-pie,--spare-dynamic-tags,3 \ -O2 -nostdlib +DFLAGS := -MM + # LFLAGS := -mcpu=cortex-m3 -mthumb -fpie -msingle-pic-base \ # -Wl,--gc-sections,-Map,main.map,-T./miosix.ld,-n,-pie,--spare-dynamic-tags,3 \ # -O2 -nostdlib @@ -35,13 +37,18 @@ all: $(OBJ) crt0.o @xxd -i main.elf | sed 's/unsigned char/const unsigned char __attribute__((aligned(8)))/' > prog3.h clean: - -rm $(OBJ) crt0.o main.elf main.map + -rm $(OBJ) crt0.o main.elf main.map *.d + +#pull in dependecy info for existing .o files +-include $(OBJ:.o=.d) %.o: %.s $(AS) $(AFLAGS) $< -o $@ %.o : %.c $(CC) $(CFLAGS) $< -o $@ + $(CC) $(DFLAGS) $(CFLAGS) $*.c > $*.d %.o : %.cpp $(CXX) $(CXXFLAGS) $< -o $@ + $(CXX) $(DFLAGS) $(CXXFLAGS) $*.cpp > $*.d diff --git a/miosix/Makefile b/miosix/Makefile index 2f87255a17faaf7b2c65be40a58fcd4313886921..f3882e99a29f9c54445c9dcdcbd810ac6e333611 100644 --- a/miosix/Makefile +++ b/miosix/Makefile @@ -44,6 +44,7 @@ OBJ := $(addsuffix .o, $(basename $(SRC))) CXXFLAGS := $(CXXFLAGS_BASE) -I. -Iarch/common -I$(ARCH_INC) -I$(BOARD_INC) CFLAGS := $(CFLAGS_BASE) -I. -Iarch/common -I$(ARCH_INC) -I$(BOARD_INC) AFLAGS := $(AFLAGS_BASE) +DFLAGS := -MM ## Build libmiosix.a and stage_1_boot.o (whose path is in BOOT_FILE) ## The file stage_1_boot.o is compiled separately because @@ -52,13 +53,18 @@ all: $(OBJ) $(BOOT_FILE) $(AR) rcs libmiosix.a $(OBJ) clean: - rm $(OBJ) $(BOOT_FILE) libmiosix.a + rm $(OBJ) $(BOOT_FILE) libmiosix.a *.d + +#pull in dependecy info for existing .o files +-include $(OBJ:.o=.cpp.d) %.o: %.s $(AS) $(AFLAGS) $< -o $@ %.o : %.c $(CC) $(CFLAGS) $< -o $@ + $(CC) $(DFLAGS) $(CFLAGS) $*.c > $*.d %.o : %.cpp $(CXX) $(CXXFLAGS) $< -o $@ + $(CXX) $(DFLAGS) $(CXXFLAGS) $*.cpp > $*.d diff --git a/miosix/compiler/mx-postlinker/Makefile b/miosix/compiler/mx-postlinker/Makefile index 581c0c8311bb781fa0f636c9a5853e6628b572b7..f5da6da69afc6d1b2ebd5f25b0ded5c572652c89 100644 --- a/miosix/compiler/mx-postlinker/Makefile +++ b/miosix/compiler/mx-postlinker/Makefile @@ -1,6 +1,7 @@ CXX:= g++ -m32 CXXFLAGS:= -O2 -c -m32 OBJS:= postlinker.o main.o +DFLAGS := -MM #create program target @@ -11,7 +12,11 @@ install: mx-postlinker cp mx-postlinker $(INSTALL_DIR) clean: - rm mx-postlinker *.o + rm mx-postlinker *.o *.d + +#pull in dependecy info for existing .o files +-include $(OBJ:.o=.d) %.o: %.cpp $(CXX) $(CXXFLAGS) $? -o $@ + $(CXX) $(DFLAGS) $(CXXFLAGS) $*.cpp > $*.d diff --git a/miosix/examples/sad_trombone/Makefile b/miosix/examples/sad_trombone/Makefile index 9b484b4da268f9aa561a5e9c3f78b365117e79e3..43e14915177efc0a69294a03d71e10510d0385f7 100644 --- a/miosix/examples/sad_trombone/Makefile +++ b/miosix/examples/sad_trombone/Makefile @@ -40,6 +40,7 @@ CFLAGS := $(CFLAGS_BASE) -I. -Imiosix -Imiosix/arch/common \ -Imiosix/$(ARCH_INC) -Imiosix/$(BOARD_INC) $(INCLUDE_DIRS) AFLAGS := $(AFLAGS_BASE) LFLAGS := $(LFLAGS_BASE) +DFLAGS := -MM LINK_LIBS := $(LIBS) -L./miosix -Wl,--start-group -lmiosix -lstdc++ -lc -lm \ -lgcc -Wl,--end-group @@ -62,7 +63,7 @@ clean-recursive: done clean-topdir: - -rm $(OBJ) main.elf main.hex main.bin main.map + -rm $(OBJ) main.elf main.hex main.bin main.map *.d main: main.elf $(CP) -O ihex main.elf main.hex @@ -73,11 +74,17 @@ main.elf: $(OBJ) miosix/libmiosix.a @ echo "linking" $(CXX) $(LFLAGS) -o main.elf $(OBJ) miosix/$(BOOT_FILE) $(LINK_LIBS) +#pull in dependecy info for existing .o files +-include $(OBJ:.o=.d) + %.o: %.s $(AS) $(AFLAGS) $< -o $@ %.o : %.c $(CC) $(CFLAGS) $< -o $@ + $(CC) $(DFLAGS) $(CFLAGS) $*.c > $*.d %.o : %.cpp $(CXX) $(CXXFLAGS) $< -o $@ + $(CXX) $(DFLAGS) $(CXXFLAGS) $*.cpp > $*.d + diff --git a/system_app_test/Makefile b/system_app_test/Makefile index c822afb4cb16d48c51aa43891676386136b24e27..9eab47095d803df6da04298fa2215253d9d219dc 100644 --- a/system_app_test/Makefile +++ b/system_app_test/Makefile @@ -21,6 +21,7 @@ CXXFLAGS := $(CFLAGS) LFLAGS := -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base \ -Wl,--gc-sections,-Map,test.map,-T./miosix.ld,-n,-pie,--spare-dynamic-tags,3 \ -O2 -nostdlib +DFLAGS := -MM LINK_LIBS := -Wl,--start-group -lstdc++ -lc -lm -lgcc -Wl,--end-group @@ -32,13 +33,18 @@ all: $(OBJ) crt0.o @xxd -i test.elf | sed 's/unsigned char/const unsigned char __attribute__((aligned(8)))/' > prog3.h clean: - -rm $(OBJ) crt0.o test.elf test.map test.txt + -rm $(OBJ) crt0.o test.elf test.map test.txt *.d + +#pull in dependecy info for existing .o files +-include $(OBJ:.o=.d) %.o: %.s $(AS) $(AFLAGS) $< -o $@ %.o : %.c $(CC) $(CFLAGS) $< -o $@ + $(CC) $(DFLAGS) $(CFLAGS) $*.c > $*.d %.o : %.cpp $(CXX) $(CXXFLAGS) $< -o $@ + $(CXX) $(DFLAGS) $(CXXFLAGS) $*.cpp > $*.d