I am using FreeRTOS on an Atmel SAM7S-256 with the IAR toolchain. While I have a proprietary board design, we can assume for the moment that I am using the Atmel development kit, as they are very similar. I am writing a boot loader that is supposed to allow updating the code in the SAM flash. I am writing the new code to an external SPI flash when it is downloaded over USB, doing the appropriate checks to ensure that code is intact. Once it is entirely downloaded and verified, it is then written to the SAM flash. Once done, I am trying to reset the processor. However, I must not understand how to reset correctly, because when I merely make the reset function in Cstartup.s79 public and call it, the RTOS does not appear to start up again. I tried just simply resetting the processor without writing new code to it, to make sure I took any erroneous code update out of the equation. Same result – RTOS locks up. Can someone help me by describing the correct way to have my code reset the processor, as if it were being first powered up? Thanks
Simply starting the software again from the start is definitely not enough as the processor and its peripherals do not get a reset. This means that the interrupts for the RTOS tick remain enabled, and will continue to trigger while your software is reinitialising all the variables back to their default values, probably also clearing the vector table. There was a thread about 3 weeks ago where somebody was doing exactly what you are attempting now and I think it had a positive conclusion. From memory it was somebody calling themselves racemouce, you might find it from searching the forum.
Thanks. I did not find the post you mentioned. However, I was able to get it to reset the processor properly. For anyone else in my situation, here is the command I found effective in resetting the SAM processor from a function running in RAM. AT91C_BASE_RSTC->RSTC_RCR = (0xA5000000 | AT91C_RSTC_PROCRST | AT91C_RSTC_PERRST);
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.