本帖最后由 aozima 于 2017-9-18 16:20 编辑
学会写链接脚本,所有芯片通用。
特别是针对GD32这种,后面有1片慢速FLASH的情况。
都把静态资源放后面去。
比如我这个 130G8的 bootloader,使用最前面1K,和后末尾的慢速7K。慢速7K的执行速度慢,所以又加载到RAM中支持。
下面是KEIL MDK 的链接脚本 GD32F130_bootloader.sct
- ; *************************************************************
- ; *** Scatter-Loading Description File generated by uVision ***
- ; *************************************************************
- ; GD32F130x8: FLASH 32KB + 32KB(慢速,且不能用于ISR入口地址)
- ; bootloader 使用最开头的1KB和最后面的11KB。
- ; load region size_region
- LR_IROM1 0x08000000 (1024 * 1)
- {
- ; load address = execution address
- ER_IROM1 0x08000000 (1024 * 1)
- {
- *.o (RESET, +First)
- *(InRoot$Sections)
- stm32f0xx_it.o(+RO)
- flash_if.o(+RO)
- stm32f0xx_hal_flash.o(+RO)
- }
- }
- ; load region size_region
- LR_IROM2 (0x08000000 + 1024 * 64 - 1024 * 7) (1024 * 7)
- {
- ; load address = execution address
- ER_IROM2 (0x08000000 + 1024 * 64 - 1024 * 7) (1024 * 7)
- {
- .ANY (+RO)
- }
- ; RW data
- RW_IRAM1 0x20000000 (1024 * 8 - 32)
- {
- crc32.o(*)
- usart.o(*)
- common.o(*)
- ymodem.o(*)
- fw.o(*)
- stm32f0xx_hal_uart.o(*)
- stm32f0xx_hal_flash_ex.o(*)
- .ANY (+RW +ZI)
- }
- }
|