ARM Technical Support Knowledge Articles

ABSOLUTE FAR VARIABLES DO NOT CALL IBANKING FUNCTIONS

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

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?

ANSWER

Your assumption is correct. The linker does not use the variable banking library version.

You can solve this problem in two ways:

  1. The linker does not detect the variable banking library, since your program does not define any far variables. You can simply add one far variable to overcome the problem:
    unsigned char far dummy;  // force linker to use variable banking libraries.
    
  2. If you do not want to define a dummy variable, you may explicitly add the banking libraries to the project. If your application requires floating point arithmetic, you have to first add the C51BFPL.LIB and then the C51BL.LIB. If you do not use floating point numbers, just add the C51BL.LIB to the project file list of your project.

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-07-18 18:32:53

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential