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

风流意气都作罢 提交于 2019-12-13 16:24:22

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/7797042/how-to-set-arm-user-app-start-address-when-using-usb-bootloader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!