Simultaneous assembly of HC12 and XGATE instructions

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Simultaneous assembly of HC12 and XGATE instructions

1,825 次查看
luckyjim
Contributor I

I'm working on a project using Absolute Assembly and would like to make use of the XGATE co-processor.
The XGATE routine I have in mind is fairly simple and I can write it in such a way that it is relocatable so can be copied into RAM and executed from there.
Is it possible to get Code Warrior 5.9.0 to assemble both HC12 and XGATE instructions in the same .asm file?

标签 (1)
标记 (1)
0 项奖励
回复
6 回复数

1,570 次查看
kef
Specialist I

I thnk that this is not possible directly. Since different assmeblers are used for S12X and XGATE, I think that you need to use conditional compiling to disable S12X code while compiling XGATE, and disable XGATE code while compiling S12X. Then you could to include your S12X source asm file (with those Ifdef __XGATE__/else/endif) in *.axgate file and add that to project.

0 项奖励
回复

1,570 次查看
luckyjim
Contributor I

Thanks for your reply kef.

CW ignores any additional files when using Absolute Assembly but I might be able to take your idea a bit further and create two projects.

One using Absolute Assembly with the main body of the code and another using relocatable assembly with essentially just the XGATE code. Once the XGATE code is generated I can extract it from the relevant output file and embed it in my main.asm file as a block of data. This can then be copied into RAM when the system is first powered up.

It's a long winded approach and it makes debugging a nightmare but the XGATE code shouldn't be too large. At this stage it only has to handle the SCI interrupt.

0 项奖励
回复

1,570 次查看
kef
Specialist I

But why not to use relocateable assembly? It should be pretty the same, except of XREF's and XDEF's to share variables and starting/ending addresses of XGATE code and vectors table.

 

What derivative you are using? Hope you know that XGATE code can be run from flash on those parts, wich have flash in ppages 0xE0 and 0xE1.

0 项奖励
回复

1,570 次查看
luckyjim
Contributor I

You're right Kef, I should use relocatable assembly - I've always used absolute assembly in the past because it's never been necessary to do otherwise and I've always been able to put code and data wherever I wanted. I'll bite the bullet this time though and give it a try.

The derivative I'm using is  12XA256. I was aware that the XGATE code can be executed from Flash but  I need to squeeze a bit more speed out the system hence the need to run it from RAM.

0 项奖励
回复

1,570 次查看
CompilerGuru
NXP Employee
NXP Employee

The XREL/XDEF's to share are even optinal, basically with a dummy prm file to satisfy the linker, it is possible to combine an HC12 absolute asm file and a XGATE absolute asm file in a single project. Shared addresses can be defined via EQU's in a include file consumed by both (or one can defined it via XDEF in one and the other one use it via XREF as suggested by Kef).

 

A minimal prm might look like this (Note that if everything is allocated absolutely, then nothing will be allocated in DEFAULT_RAM/DEFAULT_ROM. So those segments can be placed anywhere, the linker just insists that they exist and have at least a byte available and they must not overlap with anything allocated.

 

Mini prm for use with absolute XGATE/HC12 assembly code:

 

NAMES ENDPLACEMENTDEFAULT_RAM INTO NO_INIT 0x0000 SIZE 1; DEFAULT_ROM INTO READ_ONLY 0x0001 SIZE 1; ENDSTACKSIZE 0INIT Entry

 

Of course it is also possible to just use relocatable code only, the wizard generated a working project for this....

 

Daniel

0 项奖励
回复

1,570 次查看
luckyjim
Contributor I

Thanks for your reply Daniel, I've decided to use relocatable assembly since that seems to be the generally accepted method so I'll see how I get on with it  but if necessary adopt your approach if I hit any snags.

0 项奖励
回复