2013-04-28 50 views
0

我尝试CooCox CoIDE开发软件的STM32F100。错误:偏移超出范围,在CoIDE

当我加入CooCox RTOS(首席运营官)编译后,我得到一个错误信息:

[cc] Starting link 
    [cc] arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -g -nostartfiles -flto -Wl,-Map=OS_Test.map -O0 -Wl,--gc-sections -Wl,--entry=main -LC:\CooCox\CoIDE\configuration\ProgramData\OS_Test -Wl,-TC:\CooCox\CoIDE\configuration\ProgramData\OS_Test/arm-gcc-link.ld -g -o OS_Test.elf ..\obj\kernelHeap.o ..\obj\core.o ..\obj\startup_stm32f10x_md_vl.o ..\obj\core_cm3.o ..\obj\timer.o ..\obj\utility.o ..\obj\system_stm32f10x.o ..\obj\task.o ..\obj\serviceReq.o ..\obj\main.o ..\obj\mbox.o ..\obj\mm.o ..\obj\time.o ..\obj\event.o ..\obj\syscalls.o ..\obj\port.o ..\obj\queue.o ..\obj\mutex.o ..\obj\flag.o ..\obj\arch.o ..\obj\sem.o ..\obj\hook.o 
    [cc] C:\Users\Jonas\AppData\Local\Temp\cccpkRF6.s: Assembler messages: 
    [cc] C:\Users\Jonas\AppData\Local\Temp\cccpkRF6.s:240: Error: offset out of range 
    [cc] C:\Users\Jonas\AppData\Local\Temp\cccpkRF6.s:241: Error: offset out of range 

我知道这是不是太多的信息,但我还没有见过这个错误,所以我完全空白的,请帮助:)

编辑:哦,我发现,如果我改变从-O0的优化-O1误差变:

[cc] ccKXT9LB.s:1163: Error: registers may not be the same -- `strexb r0,r0,[r1]' 
    [cc] ccKXT9LB.s:1188: Error: registers may not be the same -- `strexh r0,r0,[r1]' 

回答

0

找到了!

有人更聪明比我也许可以解释,但无论如何,我得到它通过在链接器的配置取消选中“启用LTO”框固定。

右键项目 - >配置 - >链接选项卡 - >取消选中 “启用LTO”。完成..

我希望这会帮助别人。

1

Oh, and i found out that if I change the optimization from -O0 to -O1 the error becomes: [cc] ccKXT9LB.s:1163: Error: registers may not be the same -- strexb r0,r0,[r1]' [cc] ccKXT9LB.s:1188: Error: registers may not be the same -- strexh r0,r0,[r1]'

转至firmware,开放core_cm3.c的CMSIS目录和更改这些功能:

uint32_t的__STREXB(uint8_t值,uint8_t *地址)

uint32_t __STREXB(uint8_t value, uint8_t *addr) 
{ 
    uint32_t result=0; 
    __ASM volatile ("strexb %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value)); 
    return(result); 
} 

uint32_t的__STREXH (uint16_t值,uint16_t * ADDR)

uint32_t __STREXH(uint16_t value, uint16_t *addr) 
{ 
    uint32_t result=0; 
    __ASM volatile ("strexh %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value)); 
    return(result); 
} 

对于解决方案的来源,请参见herehere