AnsweredAssumed Answered

How to allocate a banked (__far) function address to uint32_t?

Question asked by snaku lee on Apr 22, 2015
Latest reply on May 3, 2015 by snaku lee


I am developing a boot-loader on MC9S12XE family with Classic CodeWarrior, I want to add a descriptor for the application code, and it should contain an address which is application code '_EntryPoint' (i.e. the address store in application's reset vector), my problem is how to allocate the '_EntryPoint' banked address to a uint32_t integer?


It is an example of my problem, if I use the type 'tIsrFunc' to allocate '_EntryPoint' is OK but 16 bit value, e.g. 0x1234U.

If I cast '_EntryPoint' to a uint32_t, the value will be shift left four bits, e.g. 0x00123400UL.

How do I cast a backed function address to uint32_t without shifted left four bits?


typedef void (*near tIsrFunc)(void);

typedef struct APP_TRY_ADDR_S


  tIsrFunc fptr_near;

  uint32_t fptr_far;



const APP_TRY_ADDR_T m_TryAddr =


  &_EntryPoint,               /* it is OK, but 16 bit only */

  (uint32_t)&_EntryPoint,     /* it is wrong, the value shifted left four bits */