HS12 define a segmented jump

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

HS12 define a segmented jump

782 Views
Molibdeno
Contributor II

Good morning,

 

I am using a MC9S12E256

The program is done in absolute assembler

In my application I am trying to create a macro that runs the code according to the page on which it is executed

 

Macro jump to address --> PAGE  and PC  ...change the page only if it is different from the point of jumping

 

JMPS  MACRO

       if ((*>>16) != PAGE(\1))         ;<-------------error...  how should I do?

       MOVB #PAGE(\1),PPAGE

       endif

       JMP    (\1 & $FFFF)

      ENDM

...........

         org    $0000C000

JMPS      MyProgramPage

...........

         org    $00308000

MyProgramPage

        JMPS MyProgram2

.............

MyProgram2

............

 

Problem:

Error: A2314 Expression must be absolute

 

How can I remove the error ?

 

Thanks for your help

Labels (1)
0 Kudos
4 Replies

551 Views
Molibdeno
Contributor II

For Radek

Yes, I understand the problem of the compiler

The compiler returns the error on the parameter \ 1 but not on *

The MACRO considers its parameters such as strings and IF does not understand which are the addresses

Where can I find the manual for using macros? ... Or the libraries with the macro examples ... With a little information I could find a solution for my problem

I can use eclipse with this microcontroller?

For Edward

I often use PPAGE and I never had problems ... my software is in assembler and is large 200KB. My application works perfectly

For years now I use assembler on 68HC11 and I am very well. I chose the MC9S12E256 for its compatibility with the 68HC11 code and for more frequency performance

When I use assembler code is cleaner and faster with more optimized functions

To simplify my code, I wanted to use macros that automatically decide when to use the change page ... A species as a pseudo-mnemonic

If you jump to a program block from one page to the macro must decide how the jump

The CALL function in some cases can not be used because they do not want to return to the point of origin RTC

if necessary I can put the NOP's below MOVB ... but I've never had problems with no NOP

Thanks Radek and Edward

0 Kudos

551 Views
RadekS
NXP Employee
NXP Employee

Hi Marcobarison,

Please look at document:

"c:\Program Files (x86)\Freescale\CWS12v5.1\Help\PDF\Assembler_HC12.pdf"

The CW10 (Eclipse) doesn’t support S12 devices (only S12Z). Since most of the CW functions is executed through command line interface, I suppose that it might be possible implement CW5.1 toolchain into Eclipse IDE. However I don’t have any experience with that solution.

Please look at "c:\Program Files (x86)\Freescale\CWS12v5.1\(CodeWarrior_Examples)\MakeFileSample_HC12"

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

551 Views
kef2
Senior Contributor IV

Marcobarison,

I'm not familiar with your assembler and * and \1 notation, no help with compile error.

Regarding paged jump: it can't be used freely like you do. Writing to PPAGE can't be done safely while executing within PPAGE window. As an asm guru you could use such trick, but you need to provide that CPU instruction queue is filled from the right location on new PPAGE with the right instructions data! Are you sure you need this? It's quite easy placing MOVB ?,PPAGE at the same 16bit address on different PPAGEs, having few NOP's below MOVB such paged jump to the same address on different PPAGE could be 100% safe. But is it worth using such technique?

If you can't use CALL instruction, then you should manipulate stack to perform paged JMP:

1. push target 16bit address

2. push target PPAGE

3. execute RTC instruction

Regards,

Edward

0 Kudos

551 Views
RadekS
NXP Employee
NXP Employee

Hi Marcobarison,

Unfortunately, my experiences with assembler are limited.

However, I suppose that there is a problem with recursion.

A macro must be defined before it is called.  In the case of IF - Conditional assembly, the <expression> must be absolute (It must be known at assembly time).

In other words: The macro must be defined prior first use, but it cannot be done because condition depends on macro parameters.

So, I would like to recommend use rather some simple compare/subtract + branch instruction instead of IF condition and this way define such universal macro (decision will be calculated by CPU).

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos