CodeWarrior warning :A12004 Value is truncated ...

Started by andr...@yahoo.co.uk April 5, 2012
I'm wondering why I'm getting lots of these warnings - (A12004) Value is truncated to two bytes. ??

They are all indicated with a JSR instruction.

The code compiles and runs - but since I moved some of the routines into paged memory, rather then the non paged area - I get these warnings.

Do I need to change a setting in CodeWarrior ? I know you have to be careful with JSR and paged memory - and I'm just calling a subroutine that is on the same page ?

Anyone any thoughts ??

Thanks

Rachel
Hi Andrew,
Your problem has to do with the addressing range of 68HC12 which is only 64K with 16 available bits. Whenever the specified address, using 16 bits, is less than $8000 or greater than $C000 it is meant to be unpaged memory. Any address between $8000 an $C000 must also specify what page you want. That's why CALL ADDR,PAGE stacks the page number and RTC unstacks the page number to return execution to the proper place. Just using JSR ADDR tries to execute code in the unpaged memory area using only 16 bit addresses. Paged subroutines can only be accessed with CALL ADDR,PAGE even if on the same page.

I don't use Codewarrior so I don't know how to specify where to load your paged subroutines. All my work is in assembly language and my paged subroutines are preceeded by ORG $8000 in the loading process.

My serial bootloader loads code at $80000 plus a specified offset. For example, code for page $33 is assembled in the window $8000 - $BFFF and loaded into memory at $CC000 - $CFFFF using the command: FLOAD 4C000. $80000 plus offset $4C000 gives the desired absolute address $CC000.

Some similar procedure must be required for loading your paged code. Hopefully this is covered somewhere in the Codewarrior documentation.

________________________________
From: "a...@yahoo.co.uk"
To: 6...
Sent: Thursday, April 5, 2012 3:34 PM
Subject: [68HC12] CodeWarrior warning :A12004 Value is truncated ...

I'm wondering why I'm getting lots of these warnings - (A12004) Value is truncated to two bytes. ??

They are all indicated with a JSR instruction.

The code compiles and runs - but since I moved some of the routines into paged memory, rather then the non paged area - I get these warnings.

Do I need to change a setting in CodeWarrior ? I know you have to be careful with JSR and paged memory - and I'm just calling a subroutine that is on the same page ?

Anyone any thoughts ??

Thanks

Rachel