cx6812 can not link code correctly

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

cx6812 can not link code correctly

1,242 Views
hbch
Contributor III
Hi,All,

I use cosmic cx6812 compiler which version is V4.6.8.

I found a  problem in linker.
The configuration in .lkf is this:

+def __FLASH_PAGED_31_START_PHY=0xC4000
+def __FLASH_PAGED_31_START_LOG=0x8000

## PPAGE = 0x31
+seg .ftext -b __FLASH_PAGED_31_START_PHY -o __FLASH_PAGED_31_START_LOG -w __PAGE_SIZE -m __SIZE_OF_FLASH -n .program_31 -sCODE
+seg .const -a .program_31  -n .const_31  -sCODE
#code here
   D:\control_code\CANBoot_DP512_cosmic\canloader.o

+def __END_OF_FLASH_PAGED_31_ACTUAL=pend(.const_31)        

After linking, the map file is following:
D:\control_code\CANBoot_DP512_cosmic\canloader.o:
start 00000000 end 000006c3 length  1731 section .text
start 00003e62 end 0000808c length 16938 section .debug

The linking result is different from my lkf configuration.
What is wrong with my project?
Can anyone help me?

Labels (1)
0 Kudos
1 Reply

384 Views
Pedro_
Contributor III
In your linker file, you have define an .ftext area where functions declared as @far would be placed, however, your functions must have been declared as @near (default).
 
Make sure to add @far or to compile using the modf switch.
 
example:
@far void myFunction (void);
 
@far void myFunction (void)
{
}
0 Kudos