Hi -I've been attempting to track down a hard fault that I've been getting when compiling eLua (http://eluaproject.net) with the 2009q3 G++ Lite release. I compiled my own toolchain with the following options (from my Makefile):
cross-binutils: mkdir -p build/binutils && cd build/binutils && \(./config.status || ../../binutils-*/configure --prefix=$(PREFIX) -- target=$(TARGET) --disable-nls --disable-werror) && \
$(MAKE) -j$(PROCS)&& \ $(MAKE) install cross-gcc: cross-binutils mkdir -p build/gcc && cd build/gcc && \(./config.status || ../../gcc-*/configure --prefix=$(PREFIX) --target= $(TARGET) --enable-languages="c" --with-gnu-ld --with-gnu-as --with- newlib --disable-nls --disable-libssp --with-newlib --without-headers --disable-shared --disable-threads --disable-libmudflap --disable- libgomp --disable-libstdcxx-pch --disable-libunwind-exceptions -- disable-libffi) && \
$(MAKE) && \ $(MAKE) install cross-g++: cross-binutils cross-gcc cross-newlib mkdir -p build/g++ && cd build/g++ && \(./config.status || ../../gcc-*/configure --prefix=$(PREFIX) --target= $(TARGET) --enable-languages="c++" --with-gnu-ld --with-gnu-as --with- newlib --disable-nls --disable-libssp --with-newlib --without-headers --disable-shared --disable-threads --disable-libmudflap --disable- libgomp --disable-libstdcxx-pch --disable-libunwind-exceptions -- disable-libffi) && \
$(MAKE) && \ $(MAKE) install cross-newlib: cross-binutils cross-gcc mkdir -p build/newlib && cd build/newlib && \(./config.status || ../../newlib-*/configure --prefix=$(PREFIX) -- target=$(TARGET) --disable-newlib-supplied-syscalls --disable- libgloss --disable-nls --disable-shared) && \ $(MAKE) -j$(PROCS) CFLAGS_FOR_TARGET="-ffunction-sections -fdata- sections -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fomit-frame- pointer -D__BUFSIZ__=256" && \
$(MAKE) installWhat's strange is that I seem to be getting blx instructions generated where with the previous G++ Lite (2009Q1) used bl, generating no hard fault. The compilation options for both versions are the same, though they differ from the CodeSourcery build options used for release (at least what's in the shell script included with the sources). Of note, the precompiled CodeSourcery binaries for 2009Q3 on Linux use bl in the same function rather than blx.
Compilation options used in both cases:Compiler Flags: -mcpu=cortex-m3 -mthumb -mlittle-endian $_CPPINCFLAGS - ffunction-sections -fdata-sections -fno-strict-aliasing %s -Wall -c $SOURCE -o $TARGET" Linker Flags: -mcpu=cortex-m3 -mthumb -Wl,-T -Xlinker -u _start -Wl,- e,Reset_Handler -Wl,-static -Wl,--gc-sections -nostartfiles -nostdlib - Wl,--allow-multiple-definition -o $TARGET $SOURCES -lc -lgcc -lm
Any ideas? Example assembler generated from C: 2009Q1 08000ce0 <platform_timer_get_diff_us>: 8000ce0: b570 push {r4, r5, r6, lr} 8000ce2: 460d mov r5, r1 8000ce4: 4614 mov r4, r2 8000ce6: 2103 movs r1, #3 8000ce8: 2200 movs r2, #0 8000cea: f7ff fff5 bl 8000cd8 <platform_timer_op> 8000cee: 42ac cmp r4, r5 8000cf0: 4602 mov r2, r08000cf2: d202 bcs.n 8000cfa <platform_timer_get_diff_us+0x1a>
8000cf4: 4623 mov r3, r4 8000cf6: 462c mov r4, r5 8000cf8: 461d mov r5, r38000cfa: 4805 ldr r0, [pc, #20] (8000d10 <platform_timer_get_diff_us+0x30>)
8000cfc: 1b63 subs r3, r4, r5 8000cfe: fba3 0100 umull r0, r1, r3, r0 8000d02: 4612 mov r2, r2 8000d04: f04f 0300 mov.w r3, #0 ; 0x0 8000d08: f01f fc08 bl 802051c <__aeabi_uldivmod> 8000d0c: bd70 pop {r4, r5, r6, pc} 8000d0e: bf00 nop 8000d10: 000f4240 .word 0x000f4240 2009Q3: 08000cd0 <platform_timer_get_diff_us>: 8000cd0: b538 push {r3, r4, r5, lr} 8000cd2: 460c mov r4, r1 8000cd4: 4615 mov r5, r2 8000cd6: 2103 movs r1, #3 8000cd8: 2200 movs r2, #0 8000cda: f7ff fff5 bl 8000cc8 <platform_timer_op> 8000cde: 42a5 cmp r5, r4 8000ce0: 4602 mov r2, r08000ce2: d202 bcs.n 8000cea <platform_timer_get_diff_us+0x1a>
8000ce4: 4623 mov r3, r4 8000ce6: 462c mov r4, r5 8000ce8: 461d mov r5, r38000cea: 4b04 ldr r3, [pc, #16] (8000cfc <platform_timer_get_diff_us+0x2c>)
8000cec: 1b2c subs r4, r5, r4 8000cee: fba4 0103 umull r0, r1, r4, r3 8000cf2: 2300 movs r3, #08000cf4: f01f ecf6 blx 80206e4 <__aeabi_uldivmod> <--- this causes the hard fault
8000cf8: bd38 pop {r3, r4, r5, pc} 8000cfa: bf00 nop 8000cfc: 000f4240 .word 0x000f4240 -- James Snyder Biomedical Engineering Northwestern University jbsnyder@xxxxxxxxxxxxxx http://fanplastic.org/key.txt ph: 847.448.0386
Attachment:
smime.p7s
Description: S/MIME cryptographic signature