From carlo.caione at gmail.com Tue May 15 22:33:57 2012 From: carlo.caione at gmail.com (Carlo Caione) Date: Wed, 16 May 2012 00:33:57 +0200 Subject: [arm-gnu] undefined instruction Message-ID: Hi, In a big project (barebox) I have this simple snippet of code in string.c size_t strlen(const char * s) { const char *sc; for (sc = s; *sc != '\0'; ++sc) /* nothing */; return sc - s; } I'm using Sourcery CodeBench Lite 2011.09-69 to compile the project. In particular for string.c: arm-none-eabi-gcc -Wp,-MD,lib/.string.o.d -nostdinc -isystem /opt/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin/../lib/gcc/arm-none-eabi/4.6.1/include -D__KERNEL__ -D__BAREBOX__ -Iinclude -I/home/carlo/projects/barebox/arch/arm/include -I/home/carlo/projects/barebox/arch/arm/include -include include/generated/autoconf.h -include /home/carlo/projects/barebox/include/linux/kconfig.h -fno-builtin -ffreestanding -D__ARM__ -fno-strict-aliasing -marm -mlittle-endian -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Iarch/arm/mach-omap/include -DTEXT_BASE=0x40200000 -fdata-sections -ffunction-sections -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -pipe -g -fno-stack-protector -Wno-unused-but-set-variable -Wno-trampolines -Wdeclaration-after-statement -Wno-pointer-sign -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(string)" -D"KBUILD_MODNAME=KBUILD_STR(string)" -c -o lib/string.o lib/string.c The problem is that the disassembly looks like: 40205c84: strlen+0 beq 0x40205d18 40205c88: strlen+4 ; instruction: 0xf03fe03a 40205c8c: strlen+8 andeq r0, r0, r6 40205c90: strlen+12 andeq r0, r0, r4 40205c94: strlen+16 andeq r0, r0, r7 40205c98: strlen+20 andeq r0, r0, sp, lsl r0 40205c9c: strlen+24 ldrdmi r0, [r0], -r3 40205ca0: strlen+28 ; instruction: 0xffffffff Why the undefined instruction? Thank you, -- Carlo From carlos_odonell at mentor.com Tue May 15 23:04:06 2012 From: carlos_odonell at mentor.com (Carlos O'Donell) Date: Tue, 15 May 2012 19:04:06 -0400 Subject: [arm-gnu] undefined instruction In-Reply-To: References: Message-ID: <4FB2E0E6.7090400@mentor.com> On 5/15/2012 6:33 PM, Carlo Caione wrote: > Hi, > In a big project (barebox) I have this simple snippet of code in string.c > > size_t strlen(const char * s) > { > const char *sc; > > for (sc = s; *sc != '\0'; ++sc) > /* nothing */; > return sc - s; > } > > I'm using Sourcery CodeBench Lite 2011.09-69 to compile the project. > In particular for string.c: > > arm-none-eabi-gcc -Wp,-MD,lib/.string.o.d -nostdinc -isystem > /opt/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin/../lib/gcc/arm-none-eabi/4.6.1/include > -D__KERNEL__ -D__BAREBOX__ -Iinclude > -I/home/carlo/projects/barebox/arch/arm/include > -I/home/carlo/projects/barebox/arch/arm/include -include > include/generated/autoconf.h -include > /home/carlo/projects/barebox/include/linux/kconfig.h -fno-builtin > -ffreestanding -D__ARM__ -fno-strict-aliasing -marm -mlittle-endian > -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=7 > -march=armv7-a -msoft-float -Iarch/arm/mach-omap/include > -DTEXT_BASE=0x40200000 -fdata-sections -ffunction-sections -Wall > -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing > -fno-common -Os -pipe -g -fno-stack-protector > -Wno-unused-but-set-variable -Wno-trampolines > -Wdeclaration-after-statement -Wno-pointer-sign > -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(string)" > -D"KBUILD_MODNAME=KBUILD_STR(string)" -c -o lib/string.o lib/string.c > > The problem is that the disassembly looks like: > > 40205c84: strlen+0 beq 0x40205d18 > 40205c88: strlen+4 ; instruction: 0xf03fe03a > 40205c8c: strlen+8 andeq r0, r0, r6 > 40205c90: strlen+12 andeq r0, r0, r4 > 40205c94: strlen+16 andeq r0, r0, r7 > 40205c98: strlen+20 andeq r0, r0, sp, lsl r0 > 40205c9c: strlen+24 ldrdmi r0, [r0], -r3 > 40205ca0: strlen+28 ; instruction: 0xffffffff > > Why the undefined instruction? What did you use to get this disassembly? When you compile with -save-temps what does the output assembly look like before being assembled? It might be that the mapping symbols are missing and your disassembling constant pool data. What are the .gnu_attribute flags for the object file? Cheers, Carlos. -- Carlos O'Donell Mentor Graphics / CodeSourcery carlos_odonell at mentor.com carlos at codesourcery.com +1 (613) 963 1026 From graub at hotmail.com Wed May 16 05:46:14 2012 From: graub at hotmail.com (Bill HG) Date: Wed, 16 May 2012 05:46:14 +0000 Subject: [arm-gnu] building the lite package in Ubuntu or MAC OS X Message-ID: Hi, I subscribed to your arm-gnu forum list... This is the issue I am encountering: the source code package arm-2009q3-68-arm-none-eabi requires that I run the script: arm-2009q3-68-arm-none-eabi.sh However every time I attempt to run the script, it fails with the following error message: ./arm-2009q3-68-arm-none-eabi.sh: line 136: sed: command not found ./arm-2009q3-68-arm-none-eabi.sh: line 136: grep: command not found This happens in Ubuntu 11.10 and MAC OS X 10.6.8 grep and sed are both installed and in the path: /bin in Ubuntu and /usr/bin in MAC OS X I will appreciate if someone publishes a workaround to this... Incidentally, the .bin installation goes very smoothly on Ubuntu, but it targets only Linux flavours, and not MAC OS X... I prefer my MAC as I am more used to it, and have put all my resources there... thanks... Billy G -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlo.caione at gmail.com Wed May 16 19:02:07 2012 From: carlo.caione at gmail.com (Carlo Caione) Date: Wed, 16 May 2012 21:02:07 +0200 Subject: [arm-gnu] building the lite package in Ubuntu or MAC OS X In-Reply-To: References: Message-ID: On Wed, May 16, 2012 at 7:46 AM, Bill HG wrote: > Hi, > > I subscribed to your arm-gnu forum list... > > This is the issue I am encountering: > > the source code package > > arm-2009q3-68-arm-none-eabi > > requires that I run the script: > > arm-2009q3-68-arm-none-eabi.sh > > However every time I attempt to run the script, it fails with the following > error message: > > ./arm-2009q3-68-arm-none-eabi.sh: line 136: sed: command not found > ./arm-2009q3-68-arm-none-eabi.sh: line 136: grep: command not found > > This happens in Ubuntu 11.10 and MAC OS X 10.6.8 > > grep and sed are both installed and in the path: > > /bin in Ubuntu > > and > > /usr/bin in MAC OS X > > I will appreciate if someone publishes a workaround to this... > > Incidentally, the .bin installation goes very smoothly on Ubuntu, but it > targets only Linux flavours, and not MAC OS X... > I prefer my MAC as I am more used to it, and have put all my resources > there... > > thanks... > > Billy G This worked well for me: https://github.com/jsnyder/arm-eabi-toolchain Enjoy :) From carlo.caione at gmail.com Wed May 16 19:43:15 2012 From: carlo.caione at gmail.com (Carlo Caione) Date: Wed, 16 May 2012 21:43:15 +0200 Subject: [arm-gnu] undefined instruction In-Reply-To: <4FB2E0E6.7090400@mentor.com> References: <4FB2E0E6.7090400@mentor.com> Message-ID: On Wed, May 16, 2012 at 1:04 AM, Carlos O'Donell wrote: > What did you use to get this disassembly? arm-none-aebi-gdb in eclipse. Without eclipse is (obviously :) the same: (gdb) disassemble Dump of assembler code for function strlen: => 0x40205c84 <+0>: beq 0x40205d18 0x40205c88 <+4>: ; instruction: 0xf03fe03a 0x40205c8c <+8>: andeq r0, r0, r6 0x40205c90 <+12>: andeq r0, r0, r4 0x40205c94 <+16>: andeq r0, r0, r7 0x40205c98 <+20>: andeq r0, r0, sp, lsl r0 0x40205c9c <+24>: ldrdmi r0, [r0], -r3 0x40205ca0 <+28>: ; instruction: 0xffffffff End of assembler dump. > When you compile with -save-temps what does the output assembly look like before being assembled? .section .text.strlen,"ax",%progbits .align 2 .global strlen .type strlen, %function strlen: .LFB83: .loc 1 223 0 .cfi_startproc @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. .LVL34: .loc 1 223 0 mov r3, r0 @ ivtmp.163, s .LVL35: .L36: .loc 1 226 0 discriminator 1 mov r2, r3 @ sc, ivtmp.163 .LVL36: add r3, r3, #1 @ ivtmp.163, ivtmp.163, .LVL37: ldrb r1, [r2, #0] @ zero_extendqisi2 @ MEM[base: sc_1, offset: 0B], MEM[base: sc_1, offset: 0B] cmp r1, #0 @ MEM[base: sc_1, offset: 0B], bne .L36 @, .loc 1 229 0 rsb r0, r0, r2 @, s, sc .LVL38: bx lr @ .cfi_endproc .LFE83: .size strlen, .-strlen This is the disassebly of the object file: Disassembly of section .text.strlen: 00000000 : 0: e1a03000 mov r3, r0 4: e1a02003 mov r2, r3 8: e2833001 add r3, r3, #1 c: e5d21000 ldrb r1, [r2] 10: e3510000 cmp r1, #0 14: 1afffffa bne 4 18: e0600002 rsb r0, r0, r2 1c: e12fff1e bx lr > It might be that the mapping symbols are missing and your disassembling constant pool data. > > What are the .gnu_attribute flags for the object file? I don't have any flags (If I have correctly understood what you mean). -- Carlo From carlos_odonell at mentor.com Wed May 16 19:55:54 2012 From: carlos_odonell at mentor.com (Carlos O'Donell) Date: Wed, 16 May 2012 15:55:54 -0400 Subject: [arm-gnu] building the lite package in Ubuntu or MAC OS X In-Reply-To: References: Message-ID: <4FB4064A.6030502@mentor.com> On 5/16/2012 1:46 AM, Bill HG wrote: > However every time I attempt to run the script, it fails with the following error message: > *./arm-2009q3-68-arm-none-eabi.sh: line 136: sed: command not found > ./arm-2009q3-68-arm-none-eabi.sh: line 136: grep: command not found* > I will appreciate if someone publishes a workaround to this... Please read the *.sh file comment header to learn about the file and what purpose it serves. > Incidentally, the .bin installation goes very smoothly on Ubuntu, but it targets only Linux flavours, and not MAC OS X... > I prefer my MAC as I am more used to it, and have put all my resources there... Unfortunately we don't don't currently support Mac OS X. I would suggest running a VM and using the Linux or Windows tools from the VM. Using a VM for development is very popular on Windows. Cheers, Carlos. -- Carlos O'Donell Mentor Graphics / CodeSourcery carlos_odonell at mentor.com carlos at codesourcery.com +1 (613) 963 1026 From carlos_odonell at mentor.com Wed May 16 20:05:45 2012 From: carlos_odonell at mentor.com (Carlos O'Donell) Date: Wed, 16 May 2012 16:05:45 -0400 Subject: [arm-gnu] undefined instruction In-Reply-To: References: <4FB2E0E6.7090400@mentor.com> Message-ID: <4FB40899.7090705@mentor.com> On 5/16/2012 3:43 PM, Carlo Caione wrote: > On Wed, May 16, 2012 at 1:04 AM, Carlos O'Donell > wrote: > >> What did you use to get this disassembly? > > arm-none-aebi-gdb in eclipse. Without eclipse is (obviously :) the same: > > (gdb) disassemble > Dump of assembler code for function strlen: > => 0x40205c84 <+0>: beq 0x40205d18 > 0x40205c88 <+4>: ; instruction: 0xf03fe03a > 0x40205c8c <+8>: andeq r0, r0, r6 > 0x40205c90 <+12>: andeq r0, r0, r4 > 0x40205c94 <+16>: andeq r0, r0, r7 > 0x40205c98 <+20>: andeq r0, r0, sp, lsl r0 > 0x40205c9c <+24>: ldrdmi r0, [r0], -r3 > 0x40205ca0 <+28>: ; instruction: 0xffffffff > End of assembler dump. Either gdb thinks this is wrong architecture/endian, or you didn't load anything and it's disassembling garbage from memory, or the probe is returning garbage for that memory location. You need to rule these out one at a time. Switch to the gdb console and issue `show architecture', then issue `show endian', what does it show? >> When you compile with -save-temps what does the output assembly look like before being assembled? That looks good. > This is the disassebly of the object file: This looks good. >> It might be that the mapping symbols are missing and your disassembling constant pool data. >> >> What are the .gnu_attribute flags for the object file? > > I don't have any flags (If I have correctly understood what you mean). Run `*-readelf -Wa` on your file (there is an run external tool for this in the IDE), and provide the output of the "Attribute section" e.g. Attribute Section: aeabi File Attributes Tag_CPU_name: "ARM7TDMI" Tag_CPU_arch: v4T Tag_ARM_ISA_use: Yes Tag_THUMB_ISA_use: Thumb-1 Tag_FP_arch: VFPv2 Tag_ABI_PCS_wchar_t: 4 Tag_ABI_FP_denormal: Needed Tag_ABI_FP_exceptions: Needed Tag_ABI_FP_number_model: IEEE 754 Tag_ABI_align_needed: 8-byte Tag_ABI_enum_size: small Tag_DIV_use: Not allowed Cheers, Carlos. -- Carlos O'Donell Mentor Graphics / CodeSourcery carlos_odonell at mentor.com carlos at codesourcery.com +1 (613) 963 1026 From carlo.caione at gmail.com Wed May 16 21:27:41 2012 From: carlo.caione at gmail.com (Carlo Caione) Date: Wed, 16 May 2012 23:27:41 +0200 Subject: [arm-gnu] undefined instruction In-Reply-To: <4FB40899.7090705@mentor.com> References: <4FB2E0E6.7090400@mentor.com> <4FB40899.7090705@mentor.com> Message-ID: On Wed, May 16, 2012 at 10:05 PM, Carlos O'Donell wrote: [cut] Ok, I think I have spotted the bug. And actually the problem seems to me related to qemu-linaro (yes, I'm emulating a Cortex-A8 with qemu) and not to CodeSourcery. In fact in the code an exact point does exist in which the strlen routine gets corrupted. (gdb) target remote :1234 Remote debugging using :1234 0x40014000 in ?? () (gdb) disassemble __mmu_cache_flush,+48 Dump of assembler code from 0x402000d0 to 0x40200100: 0x402000d0 <__mmu_cache_flush+0>: mrc 15, 0, r10, cr0, cr1, {5} 0x402000d4 <__mmu_cache_flush+4>: tst r10, #983040 ; 0xf0000 0x402000d8 <__mmu_cache_flush+8>: mov r10, #0 0x402000dc <__mmu_cache_flush+12>: beq 0x402000e8 <__mmu_cache_flush+24> 0x402000e0 <__mmu_cache_flush+16>: mcr 15, 0, r10, cr7, cr14, {0} 0x402000e4 <__mmu_cache_flush+20>: b 0x40200178 0x402000e8 <__mmu_cache_flush+24>: mcr 15, 0, r10, cr7, cr10, {5} 0x402000ec <__mmu_cache_flush+28>: push {r0, r1, r2, r3, r4, r5, r6, r7, r9, r10, r11} 0x402000f0 <__mmu_cache_flush+32>: mrc 15, 1, r0, cr0, cr0, {1} 0x402000f4 <__mmu_cache_flush+36>: ands r3, r0, #117440512 ; 0x7000000 0x402000f8 <__mmu_cache_flush+40>: lsr r3, r3, #23 0x402000fc <__mmu_cache_flush+44>: beq 0x4020016c End of assembler dump. (gdb) b *0x402000ec Breakpoint 1 at 0x402000ec (gdb) c Continuing. Breakpoint 1, 0x402000ec in __mmu_cache_flush () (gdb) disassemble strlen Dump of assembler code for function strlen: 0x40205c84 <+0>: mov r3, r0 0x40205c88 <+4>: mov r2, r3 0x40205c8c <+8>: add r3, r3, #1 0x40205c90 <+12>: ldrb r1, [r2] 0x40205c94 <+16>: cmp r1, #0 0x40205c98 <+20>: bne 0x40205c88 0x40205c9c <+24>: rsb r0, r0, r2 0x40205ca0 <+28>: bx lr End of assembler dump. (gdb) stepi 0x402000f0 in __mmu_cache_flush () (gdb) disassemble strlen Dump of assembler code for function strlen: 0x40205c84 <+0>: beq 0x40205d18 0x40205c88 <+4>: ; instruction: 0xf03fe03a 0x40205c8c <+8>: andeq r0, r0, r6 0x40205c90 <+12>: andeq r0, r0, r4 0x40205c94 <+16>: andeq r0, r0, r7 0x40205c98 <+20>: andeq r0, r0, sp, lsl r0 0x40205c9c <+24>: ldrdmi r0, [r0], -r3 0x40205ca0 <+28>: ; instruction: 0xffffffff End of assembler dump. (gdb) So, is this a qemu-linaro bug? Thank you, -- Carlo From carlos_odonell at mentor.com Thu May 17 14:25:18 2012 From: carlos_odonell at mentor.com (Carlos O'Donell) Date: Thu, 17 May 2012 10:25:18 -0400 Subject: [arm-gnu] undefined instruction In-Reply-To: References: <4FB2E0E6.7090400@mentor.com> <4FB40899.7090705@mentor.com> Message-ID: <4FB50A4E.8090607@mentor.com> On 5/16/2012 5:27 PM, Carlo Caione wrote: > Ok, I think I have spotted the bug. And actually the problem seems to > me related to qemu-linaro (yes, I'm emulating a Cortex-A8 with qemu) > and not to CodeSourcery. > In fact in the code an exact point does exist in which the strlen > routine gets corrupted. ... > 0x402000f0 in __mmu_cache_flush () > (gdb) disassemble strlen > Dump of assembler code for function strlen: > 0x40205c84 <+0>: beq 0x40205d18 > 0x40205c88 <+4>: ; instruction: 0xf03fe03a > 0x40205c8c <+8>: andeq r0, r0, r6 > 0x40205c90 <+12>: andeq r0, r0, r4 > 0x40205c94 <+16>: andeq r0, r0, r7 > 0x40205c98 <+20>: andeq r0, r0, sp, lsl r0 > 0x40205c9c <+24>: ldrdmi r0, [r0], -r3 > 0x40205ca0 <+28>: ; instruction: 0xffffffff > End of assembler dump. > (gdb) > > So, is this a qemu-linaro bug? It is most likely either a bug in the cache handling routines or a bug in QEMU's MMU emulation for the Cortex-A8. I would suggest you test upstream QEMU to see if this is fixed. If it is then you can then track down the fix and ask Linaro to backport. If it's not fixed you need to put together a test case for upstream QEMU and report the issue there. Cheers, Carlos. -- Carlos O'Donell Mentor Graphics / CodeSourcery carlos_odonell at mentor.com carlos at codesourcery.com +1 (613) 963 1026 From g4 at novadsp.com Thu May 24 21:31:20 2012 From: g4 at novadsp.com (g4 at novadsp.com) Date: Thu, 24 May 2012 22:31:20 +0100 Subject: [arm-gnu] GCC and NXP 1769 bare metal Message-ID: <4FBEA8A8.1010300@novadsp.com> Greetings. Thanks for the tooling. Invaluable. I'm trying to assemble the right spell for compiling and linking bare metal apps (FreeRTOS/lwip/FatFS) on the NXP 1769 using the arm-none-eabi compiler/linker. Currently the main problem is 'C' runtimes. By way of example the compilation command line arguments are (eliding is mine): arm-none-eabi-gcc.exe ./.../mmc.o -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -MMD -MP -Ir:/data/... arm-none-eabi-ld -nostdlib -Map="rbmap" -Trb_debugld -or:/data.../rb.axf -L R:/apps/Mentor/lib/gcc/arm-none-eabi/4.6.1/thumb The problem here is that I end up with a handsome (edited) listing of undefined references as shown below: ./obj/system_lpc17xx.o: In function `SystemCoreClockUpdate': system_lpc17xx.c:(.text.SystemCoreClockUpdate+0xb4): undefined reference to `__aeabi_uldivmod' system_lpc17xx.c:(.text.SystemCoreClockUpdate+0xd8): undefined reference to `__aeabi_uldivmod' system_lpc17xx.c:(.text.SystemCoreClockUpdate+0x154): undefined reference to `__aeabi_uldivmod' system_lpc17xx.c:(.text.SystemCoreClockUpdate+0x178): undefined reference to `__aeabi_uldivmod' system_lpc17xx.c:(.text.SystemCoreClockUpdate+0x1ee): undefined reference to `__aeabi_uldivmod' ./obj/system_lpc17xx.o:system_lpc17xx.c:(.text.SystemCoreClockUpdate+0x212): more undefined references to `__aeabi_uldivmod' follow ./obj/main.o: In function `prvTaskStatsCommand': main.c:(.text.prvTaskStatsCommand+0x1a): undefined reference to `strcpy' main.c:(.text.prvTaskStatsCommand+0x20): undefined reference to `strlen' ./obj/main.o: In function `prvRunTimeStatsCommand': main.c:(.text.prvRunTimeStatsCommand+0x1a): undefined reference to `strcpy' main.c:(.text.prvRunTimeStatsCommand+0x20): undefined reference to `strlen' ./obj/main.o: In function `prvManuallyPlaceLargeDataInAHBRAM': main.c:(.text.prvManuallyPlaceLargeDataInAHBRAM+0x7c): undefined reference to `memset' ./obj/spi-interface-to-sd-card.o: In function `prvWriteFilesToDisk': spi-interface-to-sd-card.c:(.text.prvWriteFilesToDisk+0x8c): undefined reference to `memset' ./obj/spi-interface-to-sd-card.o: In function `prvReadBackCreatedFiles': spi-interface-to-sd-card.c:(.text.prvReadBackCreatedFiles+0x94): undefined reference to `memset' .//obj/queue.o: In function `prvCopyDataToQueue': api_msg.c:(.text.err_tcp+0x3a): undefined reference to `fflush' api_msg.c:(.text.err_tcp+0x3e): undefined reference to `abort' queue.c:(.text.prvCopyDataToQueue+0x44): undefined reference to `memcpy' queue.c:(.text.prvCopyDataToQueue+0x7a): undefined reference to `memcpy' My first questions are these: 1. Which runtime libraries should be referenced when linking? 2. Linker scripts are a bit of a mystery - the NXP has 512K contiguous flash and 64K RAM in 2 possibly contiguous banks. Are there pro-forma scripts I can use? Any help greatly appreciated. ATB Jerry From jamesk at edmi.com.au Fri May 25 03:40:36 2012 From: jamesk at edmi.com.au (James Kehl) Date: Fri, 25 May 2012 03:40:36 +0000 Subject: [arm-gnu] GCC and NXP 1769 bare metal In-Reply-To: <4FBEA8A8.1010300@novadsp.com> References: <4FBEA8A8.1010300@novadsp.com> Message-ID: 1) You're using -nostdlib. Why? That's why standard libraries (like libgcc for __aeabi_uldivmod, or libc/newlib for strlen) aren't being pulled in. Note you may need to add some OS wrapper functions (like sbrk) for newlib, later - if FreeRTOS doesn't have those already. 2) Using ld directly, instead of using gcc for the final linking step, means you get to deal with all the joys of selecting the right multilib, etc. etc. Using the gcc driver is generally easier. 3) Sure FreeRTOS doesn't already have a linker file for your platform? Google suggests: http://websvn.hylands.org/filedetails.php?repname=Projects&path=%2Ffree-rtos%2Flpc17xx%2Flpc17xx.ld&rev=318&sc=0 > -----Original Message----- > From: arm-gnu-bounces at codesourcery.com [mailto:arm-gnu- > bounces at codesourcery.com] On Behalf Of g4 at novadsp.com > Sent: Friday, 25 May 2012 7:31 AM > To: arm-gnu at codesourcery.com > Subject: [arm-gnu] GCC and NXP 1769 bare metal > > Greetings. > > Thanks for the tooling. Invaluable. > > I'm trying to assemble the right spell for compiling and linking bare > metal apps (FreeRTOS/lwip/FatFS) on the NXP 1769 using the arm-none-eabi > compiler/linker. > > Currently the main problem is 'C' runtimes. By way of example the > compilation command line arguments are (eliding is mine): > > arm-none-eabi-gcc.exe ./.../mmc.o -c -fmessage-length=0 -fno-builtin > -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -MMD -MP > -Ir:/data/... > > arm-none-eabi-ld -nostdlib -Map="rbmap" -Trb_debugld > -or:/data.../rb.axf -L R:/apps/Mentor/lib/gcc/arm-none-eabi/4.6.1/thumb > > The problem here is that I end up with a handsome (edited) listing of > undefined references as shown below: > > ./obj/system_lpc17xx.o: In function `SystemCoreClockUpdate': > system_lpc17xx.c:(.text.SystemCoreClockUpdate+0xb4): undefined > reference > to `__aeabi_uldivmod' > system_lpc17xx.c:(.text.SystemCoreClockUpdate+0xd8): undefined > reference > to `__aeabi_uldivmod' > system_lpc17xx.c:(.text.SystemCoreClockUpdate+0x154): undefined > reference to `__aeabi_uldivmod' > system_lpc17xx.c:(.text.SystemCoreClockUpdate+0x178): undefined > reference to `__aeabi_uldivmod' > system_lpc17xx.c:(.text.SystemCoreClockUpdate+0x1ee): undefined > reference to `__aeabi_uldivmod' > ./obj/system_lpc17xx.o:system_lpc17xx.c:(.text.SystemCoreClockUpdate+0 > x212): > more undefined references to `__aeabi_uldivmod' follow > ./obj/main.o: In function `prvTaskStatsCommand': > main.c:(.text.prvTaskStatsCommand+0x1a): undefined reference to `strcpy' > main.c:(.text.prvTaskStatsCommand+0x20): undefined reference to `strlen' > ./obj/main.o: In function `prvRunTimeStatsCommand': > main.c:(.text.prvRunTimeStatsCommand+0x1a): undefined reference to > `strcpy' > main.c:(.text.prvRunTimeStatsCommand+0x20): undefined reference to > `strlen' > ./obj/main.o: In function `prvManuallyPlaceLargeDataInAHBRAM': > main.c:(.text.prvManuallyPlaceLargeDataInAHBRAM+0x7c): undefined > reference to `memset' > ./obj/spi-interface-to-sd-card.o: In function `prvWriteFilesToDisk': > spi-interface-to-sd-card.c:(.text.prvWriteFilesToDisk+0x8c): undefined > reference to `memset' > ./obj/spi-interface-to-sd-card.o: In function `prvReadBackCreatedFiles': > spi-interface-to-sd-card.c:(.text.prvReadBackCreatedFiles+0x94): > undefined reference to `memset' > .//obj/queue.o: In function `prvCopyDataToQueue': > api_msg.c:(.text.err_tcp+0x3a): undefined reference to `fflush' > api_msg.c:(.text.err_tcp+0x3e): undefined reference to `abort' > queue.c:(.text.prvCopyDataToQueue+0x44): undefined reference to > `memcpy' > queue.c:(.text.prvCopyDataToQueue+0x7a): undefined reference to > `memcpy' > > My first questions are these: > > 1. Which runtime libraries should be referenced when linking? > 2. Linker scripts are a bit of a mystery - the NXP has 512K contiguous > flash and 64K RAM in 2 possibly contiguous banks. Are there pro-forma > scripts I can use? > > Any help greatly appreciated. > > ATB > > Jerry > > > _______________________________________________ > arm-gnu mailing list > arm-gnu at codesourcery.com > http://sourcerytools.com/cgi-bin/mailman/listinfo/arm-gnu From freddie_chopin at op.pl Fri May 25 15:13:16 2012 From: freddie_chopin at op.pl (Freddie Chopin) Date: Fri, 25 May 2012 17:13:16 +0200 Subject: [arm-gnu] GCC and NXP 1769 bare metal In-Reply-To: <4FBEA8A8.1010300@novadsp.com> References: <4FBEA8A8.1010300@novadsp.com> Message-ID: <4FBFA18C.8060309@op.pl> W dniu 2012-05-24 23:31, g4 at novadsp.com pisze: > My first questions are these: > > 1. Which runtime libraries should be referenced when linking? > 2. Linker scripts are a bit of a mystery - the NXP has 512K contiguous > flash and 64K RAM in 2 possibly contiguous banks. Are there pro-forma > scripts I can use? You can try my template projects which have all the necessary files - Makefile, startup, linker script, vector table, ... http://www.freddiechopin.info/en/download/category/6-przyklady Adding FreeRTOS to them is just putting the files in some directory and adding the dirs in Makefile. You will usually need to add 3 definitions that assign FreeRTOS system handlers to correct vectors in the vector table. In case of problems - just ask, I've done that recently. 4\/3!! From g4 at novadsp.com Fri May 25 15:29:41 2012 From: g4 at novadsp.com (g4 at novadsp.com) Date: Fri, 25 May 2012 16:29:41 +0100 Subject: [arm-gnu] GCC and NXP 1769 bare metal In-Reply-To: <4FBFA18C.8060309@op.pl> References: <4FBEA8A8.1010300@novadsp.com> <4FBFA18C.8060309@op.pl> Message-ID: <4FBFA565.3030501@novadsp.com> Hello Freddie, Grand. Many thanks. On 25/05/2012 16:13, Freddie Chopin wrote: > W dniu 2012-05-24 23:31, g4 at novadsp.com pisze: >> My first questions are these: >> >> 1. Which runtime libraries should be referenced when linking? >> 2. Linker scripts are a bit of a mystery - the NXP has 512K contiguous >> flash and 64K RAM in 2 possibly contiguous banks. Are there pro-forma >> scripts I can use? > > You can try my template projects which have all the necessary files - > Makefile, startup, linker script, vector table, ... > > http://www.freddiechopin.info/en/download/category/6-przyklady > > Adding FreeRTOS to them is just putting the files in some directory and > adding the dirs in Makefile. You will usually need to add 3 definitions > that assign FreeRTOS system handlers to correct vectors in the vector > table. > > In case of problems - just ask, I've done that recently. > > 4\/3!! > _______________________________________________ > arm-gnu mailing list > arm-gnu at codesourcery.com > http://sourcerytools.com/cgi-bin/mailman/listinfo/arm-gnu > From kalpesh.bafna at einfochips.com Tue May 29 07:28:14 2012 From: kalpesh.bafna at einfochips.com (Kalpesh Bafna) Date: Tue, 29 May 2012 12:58:14 +0530 Subject: [arm-gnu] Application crashes in vsprintf . build with arm-none-linux-gnueabi Message-ID: <008301cd3d6c$9c3a9660$f2026e0a@EIC.COM> Hi I have a crash problem with my application running on ARM-11. I am using arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3 compiler to build the application. When i build the application with -O2 optimization it crashes in vsprintf. But when i build with -O1 it does not crashes. Does anybody have idea on this? It's urgent. Please help. Regards Kalpesh Bafna Enginner (Embedded) eInfochips Limited Pune -------------- next part -------------- An HTML attachment was scrubbed... URL: From list-bastian.schick at sciopta.com Tue May 29 16:02:52 2012 From: list-bastian.schick at sciopta.com (42Bastian) Date: Tue, 29 May 2012 18:02:52 +0200 Subject: [arm-gnu] Application crashes in vsprintf . build with arm-none-linux-gnueabi In-Reply-To: <008301cd3d6c$9c3a9660$f2026e0a@EIC.COM> References: <008301cd3d6c$9c3a9660$f2026e0a@EIC.COM> Message-ID: <4FC4F32C.10001@sciopta.com> Hi > I have a crash problem with my application running on ARM-11. "crash" is a imprecise term to get any help. Explain more what kind of crash. Even better, debug into vprintf to find the place where it "crashes". -- 42Bastian + | http://www.sciopta.com | Fastest direct message passing kernel. | IEC61508 certified. + From ricardo_anguiano at mentor.com Tue May 29 18:24:46 2012 From: ricardo_anguiano at mentor.com (Ricardo Anguiano) Date: Tue, 29 May 2012 11:24:46 -0700 Subject: [arm-gnu] Application crashes in vsprintf . build with arm-none-linux-gnueabi In-Reply-To: <008301cd3d6c$9c3a9660$f2026e0a@EIC.COM> (Kalpesh Bafna's message of "Tue, 29 May 2012 12:58:14 +0530") References: <008301cd3d6c$9c3a9660$f2026e0a@EIC.COM> Message-ID: Kalpesh Bafna writes: > I am using arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) > 4.3.3 compiler to build the application. Sourcerh G++ was rebranded to Sourcery CodeBench. The most recent Sourcery CodeBench Lite ARM GNU/Linux release (2011.09-70) is two years newer than what you are using. You can register and download the newest version here: http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ > When i build the application with -O2 optimization it crashes in > vsprintf. But when i build with -O1 it does not crashes. Does > anybody have idea on this? Sourcery CodeBench Lite is unsupported but someone on this list maybe able to help if you submit a more detailed bug report. You may find these pages helpful in generating such a report to this list. https://sourcery.mentor.com/GNUToolchain/kbentry216 http://gcc.gnu.org/bugs/ Thanks, -- Ricardo Anguiano Mentor Graphics +1-510-354-6774 From krzysztof.wesolowski at rainlabs.pl Tue May 29 18:40:15 2012 From: krzysztof.wesolowski at rainlabs.pl (=?ISO-8859-2?Q?Krzysztof_Weso=B3owski?=) Date: Tue, 29 May 2012 20:40:15 +0200 Subject: [arm-gnu] Application crashes in vsprintf . build with arm-none-linux-gnueabi In-Reply-To: References: <008301cd3d6c$9c3a9660$f2026e0a@EIC.COM> Message-ID: Reporting bugs without event checking what "crash" means? Usually compiler bug is not the first thing too look at ;) First check if nothing more obvious happens, for example different optimization levels use different amount of stack space. Regards, Krzysztof Weso?owski, tel. +48 721 337 238 On Tue, May 29, 2012 at 8:24 PM, Ricardo Anguiano wrote: > Kalpesh Bafna writes: >> I am using arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) >> 4.3.3 compiler to build the application. > > Sourcerh G++ was rebranded to Sourcery CodeBench. ?The most recent > Sourcery CodeBench Lite ARM GNU/Linux release (2011.09-70) is two years > newer than what you are using. ?You can register and download the newest > version here: > > http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ > >> When i build the application with -O2 optimization it crashes in >> vsprintf. ?But when i build with -O1 it does not crashes. ?Does >> anybody have idea on this? > > Sourcery CodeBench Lite is unsupported but someone on this list maybe > able to help if you submit a more detailed bug report. ?You may find > these pages helpful in generating such a report to this list. > > https://sourcery.mentor.com/GNUToolchain/kbentry216 > http://gcc.gnu.org/bugs/ > > Thanks, > -- > Ricardo Anguiano > Mentor Graphics > +1-510-354-6774 > _______________________________________________ > arm-gnu mailing list > arm-gnu at codesourcery.com > http://sourcerytools.com/cgi-bin/mailman/listinfo/arm-gnu