Using Banked Memory on 9S12DP512 with Assembler

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

Using Banked Memory on 9S12DP512 with Assembler

1,057 次查看
AndyUK
Contributor I

First - if this has already been answered on here - I'm sorry ... I have tried looking, but not found the answer .

 

I'm trying to understand how to use the 'Page Window' on the HCS12 to allow me to use more than the 32K of code space I currently can access (the fixed ones @ $4000 & $C000)

 

I can see how it actually works in the device (i.e. the PPAGE register etc) but what I don't understand is how to tell codewarrior what I would like it to put where.

 

I currently use 'ORG $4000'  then the code - then 'ORG $C000' then more code ... - finally 'ORG $FF80' followed by the interrupt vectors.

 

This may not be the 'correct' way - but it works - until now ....

 

The code has grown beyond this simple model, and now I need to place some of it in the 'paged' area.

 

But using things like 'ORG $308000' doesn't work.

 

Anyone got any pointers ?

 

The code is all written in assembler - not C. 

 

Thanks

 

Andy

Message Edited by AndyUK on 2010-01-21 11:01 AM
标签 (1)
标记 (1)
0 项奖励
回复
2 回复数

459 次查看
CompilerGuru
NXP Employee
NXP Employee

> But using things like 'ORG $308000' doesn't work.

 

That's exactly what I would use. So the question is what does not work? And how do you find it out?

Issues with flashing the code into the target or issues at runtime?

 

One of the issues with the banking especially when using srecords (and not directly the ELF file) different programmers are using different address schemas in srecords. Therefore CW generates in its stationary 2 srecords (with different extensions, look for *.s?, *.py and *.glo (the last one is s12x though).

I think those files are created in asm stationaries as well, but not 100% sure here. Either way the bbl file used for this for the C code stationeries can be used for asm projects as well.

 

Daniel

 

 

 

0 项奖励
回复

459 次查看
AndyUK
Contributor I

CompilerGuru wrote:

> But using things like 'ORG $308000' doesn't work.

 

That's exactly what I would use. So the question is what does not work? And how do you find it out?

Issues with flashing the code into the target or issues at runtime?

 

..........

 

Daniel

 

 

 


The plot thickens ......

 

Looks like I was wrong about the 'ORG $308000' not working. I just needed to sort out the 'SECTION' statements !

 

However ...  Now the code crashes when run in the target.

 

Just whilst playing around getting this stuff to work, I've taken one subroutine and moved it into the 'Banked' memory. Everything else has remained as it was.

 

I've changed the 'JSR' to be a 'CALL' - and the 'RTS' which terminates the subroutine has been changed to a 'RTC'

 

It all downloads into the target with no errors - and you can run it - all appears fine - the routine that has been moved is being called (I know this because it toggles the state of an LED !)

 

GREAT ! I thought - I was wrong....

 

I connect the PC to the SCI port and run the application which provides the GUI for the target when used in the real world - the target goes off into the weeds - the Debugger shows 'Unknown Event'

 

So - I commented out the 'CALL' to the routine - so it's still in the code at the same address location in the banked memory, just never gets called - now it doesn't crash.

 

Next - I put the call back in - but the first line of the subroutine is RTC - so the call is made, but nothing is done - now it does crash.

 

At this point I'm currently stuck !

 

 

Andy 

0 项奖励
回复