【问题现象1】
错误 ....sourceplatformoardstm32litearmccstm32-lite.sct(17): error: L6236E: No section matches selector - no section to be FIRST/LAST.
【问题原因1】
没有段与选择符匹配,指定为FIRST或LAST的段不存在,例如编译文件为 startup_stm32f10x_hd.s 实际在配置脚本中指定文件为 startup_stm32f10x_md.s
[mw_shl_code=c,true] RW_IRAM1 0x20000000 0x00003e00 { ; RW data
startup_stm32f10x_md.o (STACK, +First)
startup_stm32f10x_md.o (HEAP, +RW +ZI)
kbcom_stack.o (.IdleStack, +RW +ZI)
kblite_memory.o (.Region0, +RW +ZI)
kbstm32_stack.o (.BootStack, +RW +ZI)
}[/mw_shl_code]
【解决方法1】
配置正确的段名或者替换正确的文件名:
[mw_shl_code=c,true] RW_IRAM1 0x20000000 0x00003e00 { ; RW data
startup_stm32f10x_hd.o (STACK, +First)
startup_stm32f10x_hd.o (HEAP, +RW +ZI)
kbcom_stack.o (.IdleStack, +RW +ZI)
kblite_memory.o (.Region0, +RW +ZI)
kbstm32_stack.o (.BootStack, +RW +ZI)
}[/mw_shl_code]
【问题现象2】
错误....objectsstm32-litestm32-lite.axf: Error: L6223E: Ambiguous selectors found for dc.o(!!!dc) from Exec regions RW_IRAM2 and RW_IRAM3.
【问题原因2】
段未明确分配到某个region,该错误由于dc.o 中的段!!!dc没有明确指定分配到哪个Region,导致问题的配置:
[mw_shl_code=c,true] RW_IRAM2 0x20003e00 0x00001000 { ; RW data
*.o (.CoreRWdata, +ZI, +RW)
*.o (.data, +ZI +RW)
*.o (.bss)
*.o (.UserRWdata2, +RW +ZI)
.ANY (+ZI +RW)
}
RW_IRAM3 0x20004e00 0x00000200 { ; RW data
*.o (.UserRWdata, +RW +ZI)
}[/mw_shl_code]
【解决方法2】
将未指定的段配置到相应Region
[mw_shl_code=c,true] RW_IRAM2 0x20003e00 0x00001000 { ; RW data
*.o (.CoreRWdata, +ZI, +RW)
*.o (.data, +ZI +RW)
*.o (.bss)
dc.o (!!!dc)
dc.o (!!!dc_sizes)
*.o (.UserRWdata2, +RW +ZI)
.ANY (+ZI +RW)
}
RW_IRAM3 0x20004e00 0x00000200 { ; RW data
*.o (.UserRWdata, +RW +ZI)
}[/mw_shl_code]
【问题现象3】
....sourceplatformoardstm32litearmccstm32-lite.sct(28): warning: L6329W: Pattern *.o(!!!dc) only matches removed unused sections.
【问题原因3】为解决问题2,为!!!dc配置到某个Region后出现该问题,分配到某个Region的段由于未被使用而移除,导致问题的配置:
[mw_shl_code=c,true] RW_IRAM2 0x20003e00 0x00001000 { ; RW data
*.o (.CoreRWdata, +ZI, +RW)
*.o (.data, +ZI +RW)
*.o (.bss)
dc.o (!!!dc)
dc.o (!!!dc_sizes)
*.o (.UserRWdata2, +RW +ZI)
.ANY (+ZI +RW)
}
RW_IRAM3 0x20004e00 0x00000200 { ; RW data
*.o (.UserRWdata, +RW +ZI)
}[/mw_shl_code]
【解决方法3】
为解决问题2加入!!!dc配置导致问题3,但是删除!!!dc的配置又会导致2,怎么解决呢?实际上该问题是由于配置了多个ROM/RAM后,有多个Region出现模糊配置。armcc只允许一个Region使用模糊配置,解决办法:删除 !!!dc的配置,并修改其他Region中的段及文件名完全匹配(将 RAM3 中的*.o改为正确的文件名。
[mw_shl_code=c,true] RW_IRAM2 0x20003e00 0x00001000 { ; RW data
*.o (.CoreRWdata, +ZI, +RW)
*.o (.data, +ZI +RW)
*.o (.bss)
*.o (.UserRWdata2, +RW +ZI)
.ANY (+ZI +RW)
}
RW_IRAM3 0x20004e00 0x00000200 { ; RW data
testtask.o (.UserRWdata, +RW +ZI)
caobject.o (.UserRWdata, +RW +ZI)
}[/mw_shl_code]
【问题现象4】
....sourceplatformoardstm32litearmccstm32-lite.sct(34): warning: L6314W: No section matches pattern *.o(.UserRWdata2)..
【问题原因4】
指定的段不存在,导致问题的配置:
[mw_shl_code=c,true] RW_IRAM2 0x20003e00 0x00001000 { ; RW data
*.o (.CoreRWdata, +ZI, +RW)
*.o (.data, +ZI +RW)
*.o (.bss)
dc.o (!!!dc)
dc.o (!!!dc_sizes)
*.o (.UserRWdata2, +RW +ZI)
.ANY (+ZI +RW)
}
RW_IRAM3 0x20004e00 0x00000200 { ; RW data
*.o (.UserRWdata, +RW +ZI)
}[/mw_shl_code]
【解决方法4】
删除不存在的段,或者检查代码将其修改为正确的段名
[mw_shl_code=c,true] RW_IRAM2 0x20003e00 0x00001000 { ; RW data
*.o (.CoreRWdata, +ZI, +RW)
*.o (.data, +ZI +RW)
*.o (.bss)
.ANY (+ZI +RW)
}
RW_IRAM3 0x20004e00 0x00000200 { ; RW data
*.o (.UserRWdata, +RW +ZI)
}[/mw_shl_code]
或者修改C代码:
[mw_shl_code=c,true]STATIC __attribute__ ((section(".UserRWdata2"))) VOLATILE DWORD g_TaskCount = 0;
STATIC __attribute__ ((section(".UserRWdata2"))) HANDLE g_TestHandles[2] =
{
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE
};
[/mw_shl_code]
【完整配置】
[mw_shl_code=c,true]; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
LR_IROM1 0x08000000 0x0000D000 { ; load region size_region
ER_IROM1 0x08000000 0x0000D000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
*.o (.CoreText, +RO)
*.o (.UserText, +RO)
*.o (.CoreROdata, +RO)
*.o (.UserROdata, +RO)
.ANY (+RO)
}
RW_IRAM1 0x20000000 0x00003e00 { ; RW data
startup_stm32f10x_hd.o (STACK, +First)
startup_stm32f10x_hd.o (HEAP, +RW +ZI)
kbcom_stack.o (.IdleStack, +RW +ZI)
kblite_memory.o (.Region0, +RW +ZI)
kbstm32_stack.o (.BootStack, +RW +ZI)
}
RW_IRAM2 0x20003e00 0x00001000 { ; RW data
*.o (.CoreRWdata, +ZI, +RW)
*.o (.data, +ZI +RW)
*.o (.bss)
.ANY (+ZI +RW)
}
RW_IRAM3 0x20004e00 0x00000200 { ; RW data
testtask.o (.UserRWdata, +RW +ZI)
caobject.o (.UserRWdata, +RW +ZI)
}
}
[/mw_shl_code]
一周热门 更多>