USBDM MC9S12G96 programming problem

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

USBDM MC9S12G96 programming problem

Jump to solution
1,060 Views
rdr
Contributor II

9S12G96 programs normally until I try to add code starting at flash address $8000.

The USBDM shows "program data not within target flash memory".

The PPAGE is set to $0e (default value). This should make the $8000..$bfff page visible for programming.

Pages $4000..$7fff and $c000.. $ffff all program pefectly well.

Thanks for any help.

 

0 Kudos
1 Solution
1,039 Views
pgo
Senior Contributor V

Hi,

The situation is as described above but there is a simpler solution.  If you add pageReset="0x0E" to the paged memory range it should accept programming in the paged area and will set the PPAGE accordingly (0xE).

 <memoryRange start="0x8000" end="0xBFFF" pageReset="0x0E" pages="128K" pageEnd="0x0F" />

This has not been tested as I can't find a suitable device for testing.

bye

 

 

View solution in original post

0 Kudos
4 Replies
1,050 Views
pgo
Senior Contributor V

Hi,

There isn't sufficient information to suggest a reason with any certainty.

The PPAGE is set to $0e (default value).

Does the image you are programming assume that the PPAGE actually has a value i.e. the image has data in the range 0x8000 to 0xBFFF that is destined for page 0xE?  If so, that is the problem.  The programmer has no way of knowing what PPAGE value you are using - this is something that is done by your running program.  It's not psychic.

The programmer uses the following memory map:

 <memory pageAddress="0x0015" registerAddress="0x0100" type="flash" securityAddress="0xFF00" sectorSize="512" alignment="8">
<securityEntryRef ref="HCS12-fprot-eeprot-fopt-security" />
<memoryRange start="0x1000" end="0x1FFF" /> <!-- Gap between EEPROM and RAM -->
<memoryRange start="0x4000" end="0x7FFF" />
<memoryRange start="0x8000" end="0xBFFF" pages="6" pageEnd="0x0F" />
<memoryRange start="0xC000" end="0xFFFF" />
</memory>

Most development tools will create an image containing data for page 0xE.  This will have a paged  address range of [0xE8000,0xBFFF] as required by the programmer.  You running program can set the PPAGE to E and access that data in the expected location.  I know Codewarrior used to do this but it's been a long time since I've used it.

Solutions (assuming the above is the problem):

  1. Modify your linker map to correctly create the image - sorry I have no idea of the details.
  2. Edit .../DeviceData/hcs12_devices.xml to add a small memory model e.g. MC9S12G96_small based on an existing model.   If you remove the pageAddress=... the programmer should not access PPAGE and the reset default will be unchanged.  This will be effectively the model you are using.  Obvious broken if you go beyond 64k (small model).

The above is pure guesswork.

bye

 

 

0 Kudos
1,043 Views
rdr
Contributor II

Hi pgo,

Thank you for the prompt reply.

Firstly, some clarification:

I use several S12 variants namely S12XE256, S12G48, S12P128 and S12G96.

I use assembly language for all my applications (really!).

My images are assembled using "AS12" assembler. Despite it's age has served me well for over 20 years.

 

The S-records generated by as12 all look perfectly correct. I assume the S-records are what really matters to the USBM programmer.

As a test I ran some small programs on an S12G48. This has 48K of contiguous Flash memory from $4000 to $ffff. Note that the $8000 to $bfff block is NOT paged, just linear address space.

The first program used two blocks of memory (org) at $4000 and also memory (org) at $c000. This works perfectly well. 

The second program used 3 blocks of memory (org) $4000, $8000, $c000. This program was identical to the first except for about 20 lines of code starting at $c000. This failed to program with the usual "program data not within target flash memory".

Note that I have used full memory map programming on the S12XE256 without problems. 

This problem appears to be peculiar to the programming of G48, G96 and G128 variants (that I have tested anyway).

Thanks for any insights.

0 Kudos
1,040 Views
pgo
Senior Contributor V

Hi,

The situation is as described above but there is a simpler solution.  If you add pageReset="0x0E" to the paged memory range it should accept programming in the paged area and will set the PPAGE accordingly (0xE).

 <memoryRange start="0x8000" end="0xBFFF" pageReset="0x0E" pages="128K" pageEnd="0x0F" />

This has not been tested as I can't find a suitable device for testing.

bye

 

 

0 Kudos
1,022 Views
rdr
Contributor II

Hi pgo,

<memoryRange start="0x8000" end="0xBFFF" pageReset="0x0E" pages="128K" pageEnd="0x0F" />

This fixed the problem.

Note the need to change  pages="128K"  to "96K" or "48K" to suit the G series variant. 

Thanks again.

0 Kudos