Hello, guys,
Here is a question about Codewarrior's linking.
Before this question comes up, we link our program together with "Runtime.PPCEABI.H.a" supplied by Codewarrior. And it goes well.
But when "Runtime.PPCEABI.H.a" is not present in our project, there are more than 100 similar linking errors coming up, like "undefined _savegpr_23", "undefined _savegpr_27", etc.
In my opinion, it seems that if possible, CodeWarrior will use general purpose registers to store local variables in function block,
The sample code goes below:
U32 flash_block_erase(U32 addr_first, U32 addr_last)
{
U32 flag = 0;
U32 base = 0;
U32 block_first = 0;
U32 tmp = 0;
U32 num = 0;
U32 index = 0;
U32 ret = ERROR_NONE;
U32 base_addr[NOR_FLASH_BANKS_NUM] = NOR_FLASH_BASE_ADDR_SET;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Link error is as follows:
Link Error : undefined: '_savegpr_23'
Referenced from 'flash_block_erase' in nor_flash.o
Link Error : undefined: '_restgpr_23'
Referenced from 'flash_block_erase' in nor_flash.o
.......
Link Error : too many link errors
Link failed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The result of disassmble of sample code using CodeWarrior is below:
Hunk: Kind=HUNK_GLOBAL_CODE Name="flash_block_erase" Size=388
Source file (.debug): nor_flash.c
Producer: MW EABI PPC C-Compiler
; 632: U32 flash_block_erase(U32 addr_first, U32 addr_last)
; 633: {
000006E8: 00000000: 9421FFC0 stwu rsp,-64(rsp)
000006EC: 00000004: 7C0802A6 mflr r0
000006F0: 00000008: 90010044 stw r0,68(rsp)
000006F4: 0000000C: 39610040 addi r11,rsp,64
000006F8: 00000010: 48000001 bl _savegpr_23
000006FC: 00000014: 7C771B78 mr r23,r3
00000700: 00000018: 7C982378 mr r24,r4
; 634: U32 flag = 0;
00000704: 0000001C: 3B400000 li r26,0
; 635: U32 base = 0;
00000708: 00000020: 3BC00000 li r30,0
; 636: U32 block_first = 0;
0000070C: 00000024: 3BA00000 li r29,0
; 637: U32 tmp = 0;
00000710: 00000028: 3B800000 li r28,0
; 638: U32 num = 0;
00000714: 0000002C: 3B200000 li r25,0
; 639: U32 index = 0;
00000718: 00000030: 3BE00000 li r31,0
; 640: U32 ret = ERROR_NONE;
0000071C: 00000034: 3B600000 li r27,0
; 641: U32 base_addr[NOR_FLASH_BANKS_NUM] = NOR_FLASH_BASE_ADDR_SET;
; 642:
00000720: 00000038: 80000000 lwz r0,@205@sda21
00000724: 0000003C: 90010008 stw r0,8(rsp)
Does anybody has experience in dealing with this kind of errors ?
Any suggestion is welcome.
Thanks in advance.
Best Regards,
Shawn