Dual Target Project

cancel
Showing results for 
Search instead for 
Did you mean: 

Dual Target Project

Jump to solution
321 Views
sebasira
Senior Contributor I

Hello everyone!

 

I've got a project for a HCS12-128 (MC9S12A128) and I want to load it into the same hardware but with a HCS12-256 (MC9S12A256). On the 128 works fine, but  when I load it into 256 it won't pass the startup. The startup is the one created by the project wizard (for 1258). (Note, if it helps, I'm working with CW v4.6).

 

It gets stuck inside Init rigth after start execution. Here's a portion of it

 

static void Init(void) {

/* purpose:     1) zero out RAM-areas where data is allocated   */

/*              2) copy initialization data from ROM to RAM     */

/*              3) call global constructors in C++              */

/*   called from: _Startup, LibInits                            */

   __asm {

ZeroOut:

             LDX   _startupData.pZeroOut        ; *pZeroOut         

             LDY   _startupData.nofZeroOuts     ; nofZeroOuts

             BEQ   CopyDown                     ; if nothing to zero out

 

When loaded into a 128 MCU, in the ASM window I see:

 

388000   LDX    0xC00D

388003   LDY    0xC00B

388006   BEQ    *+16

 

 

Instead, when I load it into the 256 MCU:

 

388000   BGND

388001   BGND

388002   BGND

388003   BGND


 

Why is this happening?

 

 

I'm guessing it could be related to PRM file, so I attached it. With other projects I've done the same thing and I did not have any problem, and the only difference is that now I've touch the PRM from it's default.

 

Any input is appreciatted! Thanks!

 

 

 

 

 

 

Original Attachment has been moved to: PRM-for-12.prm.zip

Labels (1)
0 Kudos
1 Solution
174 Views
sebasira
Senior Contributor I

I've just solve it by setting INITRM = 0x00, before calling INIT() so RAM would be at 0x0000

View solution in original post

0 Kudos
3 Replies
174 Views
sebasira
Senior Contributor I

New information!

I don't know why but ASM windows is not working and that's why is showing BGND. If I step the code, I can see how X and Y are correctly loaded.

Now, I guess the problem is that RAM is not "RAM"... If I go to address 0x000800 wich is RAM start address, I see all 0xFF in the 256 and 0x00 in 128. Stack pointer is set right there and when adding values, this portion of memory can not be written. So then the problem is that it PUSH-PULL Y and always reads back 0xFFFF so it never pass startup.

If I try to change the memory content manually, I cannot.

0 Kudos
175 Views
sebasira
Senior Contributor I

I've just solve it by setting INITRM = 0x00, before calling INIT() so RAM would be at 0x0000

0 Kudos
174 Views
kef
Specialist I

INITRM = 0x39 or 0x3F is the best setting for all S12D / S12A. It makes RAM aligned with the top RAM address at 0x3FFF. Making app for S12D64 with RAM in PRM placed at 0x3F00..0x3FFF, will make the same app working on all higher S12D family members.

0 Kudos