Issue with HCS08 RAM Integrity Checks during powerup.

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

Issue with HCS08 RAM Integrity Checks during powerup.

978 Views
admin
Specialist II


Hi,

 

We are using MC9S08DZ60 processor in our project. I am trying to conduct RAM integrity checks starting from 0x0080 to 0x107F only during powerup soon after entering main loop before enabling the interrupts. RAM integrity algorithm works something like this. It saves existing two bytes of data, writes the actual 2 byte address into the same location as data and reads it back to compare with the address. Hardware vulnerabilities observed during bench testing. Continuous read and write operations of contiguous RAM locations prevents write access after specific number of continuous write cycles. The failure after specific number of write cycles remains same in any power cycle. This failure to write the data sets a fault as my algorithm checks the data which is written and compares it with the address. While single read or write operation at a time doesn’t create above failure condition when tried through debugger.

 

Any ideas for this behaviour.

Labels (1)
0 Kudos
Reply
3 Replies

522 Views
bigmac
Specialist III

Hello,

Perhaps your stack is within the RAM range you are attempting to test.  It is almost certain that your test procedure will require stack usage.  Maybe you need to split your RAM into two blocks, where you alter the stack pointer between the testing of each block.  The stack would reside within the block you are not currently testing.  This would also apply to where you are saving the two bytes of data associated with the testing of each word, if it is not the stack.

Regards,

Mac


0 Kudos
Reply

523 Views
admin
Specialist II

Mac,

Thanks for the quick reply. Since linker takes the specified stack size from linker parameter (.prm) file, fixes the starting location of stack at a specified  address which is mentioned in ".map" file. I am wondering the dynamic allocations of stack pointer can be possible only through #pragma directives or through direct assembly instructions[Load/Store]. Is there a better way we can change the stack pointer locations in metro works compiler environment dynamically and restore it back to map file defined address after checks?

Thanks,

Dileep

0 Kudos
Reply

523 Views
bigmac
Specialist III

Hello Dileep,

By default, the PRM file uses the STACKSIZE parameter, which means that the normal location of the stack is always unpredictable.  This is because the bottom of the stack commences immediately following your global and static variables.  The stack location can be totally predictable if you make use of the STACKTOP parameter, rather than STACKSIZE.  You will also need to explicitly define a stack segment within the PRM file so that an error message will occur should the variables happen to stray into the stack segment.  This should simplify your stack pointer manipulations.

SEGMENTS

   Z_RAM     = READ_WRITE   0x0080 TO 0x00FF

   RAM       =  READ_WRITE  0x0100 TO 0x0FFF

   STACK_SEG = READ_WRITE   0x1000 TO 0x107F

   ...

END

...

STACKTOP  0x107F

VECTOR  0 _Startup

I might suggest that you place the temporary stack within page zero whilst you test the remainder of RAM memory.  You can then place the stack at the normal location, and then proceed to test page zero RAM.

Adjusting the stack pointer can easily be done with HLI assembly code - you could define some macros -

#define TEST_STACK __asm ldhx #0x0100; __asm txs

#define NORM_STACK __asm ldhx #0x1080; __asm txs

In case you are wondering, the addresses shown above are correct since the stack pointer will be decremented by one from these values (the operation of the TXS instruction).

Regards,

Mac


0 Kudos
Reply