最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

stm32 - How to use define in scatter file in mdkarm keil - Stack Overflow

programmeradmin3浏览0评论

I have this linker script from keil and i want to use define to allocate base address based on that define. But i get errors. I tried gpt and others but not solved. `

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
; Custom scatter file for STM32F051

LR_IROM1 0x08007C00 0x00008000  {    ; load region size_region
  ER_IROM1 0x08007C00 0x00008000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }
  
  RW_IRAM1 0x20000000 0x00002000  {  ; RW data
   .ANY (+RW +ZI)
  }
}

I want this

#define NEW_BASE_ADDRESS 0x08007C00

LR_IROM1 ${NEW_BASE_ADDRESS} 0x00008000  {    ; load region size_region
  ER_IROM1 ${NEW_BASE_ADDRESS} 0x00008000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }
  
  RW_IRAM1 0x20000000 0x00002000  {  ; RW data
   .ANY (+RW +ZI)
  }
}

But i get these errors

missing base address for lr_irom1. ignoring unknown attribute '$' specified fr region lr_irom1.

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
; Custom scatter file for STM32F051

LR_IROM1 0x08007C00 0x00008000  {    ; load region size_region
  ER_IROM1 0x08007C00 0x00008000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }
  
  RW_IRAM1 0x20000000 0x00002000  {  ; RW data
   .ANY (+RW +ZI)
  }
}

I want this

#define NEW_BASE_ADDRESS 0x08007C00

LR_IROM1 ${NEW_BASE_ADDRESS} 0x00008000  {    ; load region size_region
  ER_IROM1 ${NEW_BASE_ADDRESS} 0x00008000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }
  
  RW_IRAM1 0x20000000 0x00002000  {  ; RW data
   .ANY (+RW +ZI)
  }
}

But i get these errors

missing base address for lr_irom1. ignoring unknown attribute '$' specified fr region lr_irom1

发布评论

评论列表(0)

  1. 暂无评论