Search code examples
armembeddedbootloadercortex-m

How to set ARM user app start address when using USB bootloader?


Just picked up one of these ARM Cortex-M3 LPC1768 mini boards from eBay. It's basically a breakout board.

However, based on what little documentation came with it, I've determined that it has a USB bootloader similar to that described by NXP's LPC1700 secondary USB bootloader (AN10866) app note.

Both docs (the app note and board docs) indicate that user programs are to be built such that their starting address is 0x2000. Because the USB bootloader is already at 0x0 and takes up 8K.

Both docs also show screenshots (see page 14 of app note) on how to do this within Keil uVision, however I'm planning on using a GNU toolchain (Yagarto + Eclipse + OpenOCD).

How do I specify a starting address of 0x2000 when compiling with a GNU toolchain so that it will work properly with the USB bootloader?


Solution

  • I have lots of arm based examples:

    https://github.com/dwelch67

    Find or create your own linker script. where it might have said ORIGIN = 0x00000000 for the rom change that to 0x2000, something like this for example:

    MEMORY
    {
       rom : ORIGIN = 0x00002000, LENGTH = 0x6000
       ram : ORIGIN = 0x40000000, LENGTH = 0x2000
    }
    SECTIONS
    {
       .text : { *(.text*) } > rom
       .bss  : { *(.bss*) } > ram
    }
    

    you might want/need a .data with

       .data  : { *(.data*) } > ram AT >rom
    

    or something like that. depends on your programs and boot code and all that.

    If you already have a working system that builds for 0x00000000 then find the linkerscript being used and make a copy of it and change it to 0x2000 and specify that linker script.