8 years, 7 months ago.

Exporting mbed progam to LPCXpresso

Hi, I'm quite new to this but am trying to export a program I have written on the online compiler to LPCXpresso. I am using both the LPC1768 mbed platform and a custom PCB that I have made with an LPC1768. The problem I have been having is that when using the online compiler's export function the linker file created by the online compiler is not compatible with the Ethernet Interface library's calls to place arrays in peripheral RAM . This manifests as LPCXpresso attempting to place all data meant to be located in AHBSRAM0 and AHBSRAM1 (Defined as the ethernet ram locations on the LPC1768 mbed) is not placed in the peripheral RAM section by the LPCXpresso compiler and the error message

'RAMLoc32' is overflowed by 9861 Bytes

is produced. I've got around this by replacing all calls to the AHBSRAM banks with calls to 'RAM2' which the linker script knows is referring to the peripheral RAM areas. This then allows the code to compile, but not properly as once the program is left to run for more than about 30 seconds I return a hard fault (Precise Bus Fault, Location 0x10008000, the top of program RAM). This program when compiled on the online compiler has run for a week with no such faults, so I'm guessing the problem is within either optimization or the linker script. Has anybody managed to get around this?

Ah, ok. Can you use this linker script file, then?

/media/uploads/MACRUM/lpc1768.ld

posted by Toyomasa Watarai 18 Sep 2015

1 Answer

8 years, 7 months ago.

Hi,

The linker script file of the LPCXpresso target (GCC_CR) seems to be incorrect, since it defines an RamAHB32 region from 0x2007c000 with 0x8000 length and the RAM2 section assigned from start of RamAHB32 region.

In that case, your data with RAM2 section will be assigned from 0x2007c000 which is USB RAM area rather than RAM for ethernet.

Can you replace your linker script (LPC1768.ld) file from here?

https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_ARM/LPC1768.ld

I tried this but it just produced a (very long) list of errors, including final link failed and many undefined function calls (I'm guessing due to the mem/memp files must not linking correctly). Some things that aren't defined: _dso_handle

memcpy

memset

strcmp

_aeabi_d2f, _aebi_d2iz....

posted by Nick Slack 17 Sep 2015