AnsweredAssumed Answered

9S08AC secure programming

Question asked by Johan Forslöf on Mar 31, 2014



I seem having a bit of trouble downloading a secured firmware from CodeWarrior 10.5 with a P&E Multilink. I this should be possible since it used to work in the pre-Eclipse days, though admittedly those projects used different HCS08/12 parts.


Anyway, whenever SEC00/SEC01 of NVOPT are programmed with anything besides 1/0 via the IDEs debug/run functions the process fails. I get a dialog asking whether to unsecure the device at the start of programming, whether or not it was previously programmed with security enabled, and attempting to proceed results in a seemingly disabled firmware.


However setting up a custom programming option through the "FLASH file to target" dialog to download the raw hex image does work. Unfortunately I have not enable to get this this method to write a NVICGTRM calibration value.


Any suggestions on how to get this working? In production this will be handled with a Cyclone PRO but it also needs to be testable during development, field-upgradable for prototypes and what not. The datasheet seems to suggest that an initial debugging session up to the next MCU reset should be possible which would be quite useful but I'd settle for plain programming.


As an aside are there any sanctioned illegal opcodes suitable for issuing a software reset? I have been using  a NOP with a stack prefix ($9E:9D) but just picking one at random does seem a bit iffy.


For the record here is a quick repro case toggling a pin to demonstrate that the device is alive:

#include "mc9s08ac32.h" const unsigned char nvopt @ 0xFFBF = 0 << NVOPT_SEC0_BITNUM; void main(void) {     for(;;) {         unsigned int delay = 10000;         do { __RESET_WATCHDOG(); } while(--delay);         PTED_PTED2 ^= 1;         PTEDD_PTEDD2 = 1;     } }