Problem using paged memory

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

Problem using paged memory

Jump to solution
867 Views
danielmilutinov
Contributor III

Hi,

I have been using CodeWarrior IDE v5.9.0 build 5294 (Development Studio for S12(X) v5.2 build 151201) on a Windows7 machine for about a year to upload assembly code to the DEVKIT S12G128 board without any problems. Last week I started using paged memory as my project has exceeded 64K. I now receive an error message when trying to upload code to the DEVKIT S12G128. 

I can't even upload the following simple program:

Image 2.png

Pressing "Make" assembles this program without a problem, and I can view the main.asm.o.lst file but when I connect the DEVKIT S12G128 and press "Debug" I receive the following error messages:

Image 4.png

Image 5.gif

I tried opening a new project and also tried uploading from another computer with the same version of CodeWarrior, but the same error messages appear. 

As mentioned above, programs that do not have paged memory upload without any problems. 

Please help!

1 Solution
589 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi Daniel,

I'm very sorry for confusing information, forget my first response please. 

You need to use local address as you do at first.

Your error will happen, when you use PAGE_0AStart:       equ   $00028000 -> this address is global and you are accessing out of memory.

When you want to access on the PAGE 0xA, you need to use alternative addressing for PPAGE.

So, address will be  $0A8000 

pastedImage_4.png

This should work:

             ORG    $4000

entry:    LDS      #$4000
             LDAA    #$01
             CALL    sub1
             INCA
loop:     BRA      loop

;-------------------
             ORG    $0A8000
sub1:    INCA
             RTC

I hope it helps you.

Best regards,

Diana

View solution in original post

4 Replies
588 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi Daniel,

I assume, the error message means you are writing to the wrong address.

For writing to flash must be used global address, because only global address is accepted for writing.

Local address 0x4000 corresponds to Global address 0x34000.

I attached memory map for the S12G. 

For better understanding, here is detailed description about difference between local and global address: 

https://community.nxp.com/message/636153?commentID=636153#comment-636153 

and useful examples: S12G Examples Pack 

I hope it helps you.

Best regards,

Diana

0 Kudos
588 Views
danielmilutinov
Contributor III

Hi Diana, thanks for your reply. Can you please tell me what changes I need to make to the code? Do you mean I should change it to:

Image 7.png

What about ORG $FFFE? Are you saying that all addresses must be changed to global when using paged memory? Can someone please show me what changes need to be made to the code to get it to work?

0 Kudos
590 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi Daniel,

I'm very sorry for confusing information, forget my first response please. 

You need to use local address as you do at first.

Your error will happen, when you use PAGE_0AStart:       equ   $00028000 -> this address is global and you are accessing out of memory.

When you want to access on the PAGE 0xA, you need to use alternative addressing for PPAGE.

So, address will be  $0A8000 

pastedImage_4.png

This should work:

             ORG    $4000

entry:    LDS      #$4000
             LDAA    #$01
             CALL    sub1
             INCA
loop:     BRA      loop

;-------------------
             ORG    $0A8000
sub1:    INCA
             RTC

I hope it helps you.

Best regards,

Diana

588 Views
danielmilutinov
Contributor III

Hi Diana,


You are a champion, that works perfectly!


Thank you very much for all of your help!


Regards,


Daniel

0 Kudos