| ARM Technical Support Knowledge Articles | |
Applies to: C51 C Compiler
Information in this article applies to:
I'm using far variables to access a Flash device in my application. Currently, I have a very simple test code that just tests my configuration. Here is my program:
#pragma VARBANKING #include <absacc.h>
#define FLASH_BASE 0x80000 #define FlashCmdAddr1 FVAR(unsigned char, FLASH_BASE + 0x555) #define FlashCmdAddr2 FVAR(unsigned char, FLASH_BASE + 0xAAA) #define TEST_BYTE FVAR(unsigned char, FLASH_BASE) static void FlashCmd (
unsigned char cmd,
unsigned char far* addr) { FlashCmdAddr1 = 0xaa; FlashCmdAddr2 = 0x55; *addr = cmd; } void main (void) { while (1) { FlashCmdSector (0xa0, &TEST_BYTE); TEST_BYTE = 1; } }
The problem is the software does not call the ?C?CLDXPTR and ?C?CSTXPTR that are defined in the L51_BANK.A51 or XBANKING.A51 file. It seems the linker is loading C51L.LIB instead of C51BL.LIB.
How can I solve this problem?
Your assumption is correct. The linker does not use the variable banking library version.
You can solve this problem in two ways:
unsigned char far dummy; // force linker to use variable banking libraries.
Article last edited on: 2005-07-18 18:32:53
Did you find this article helpful? Yes No
How can we improve this article?