Hello,
I was writing a project for an s32k118 48pin microcontroller on custom hardware, when I came across an unexpected problem; the code I flash to the MCU does not appear to be persistent. When I power-cycle the board, the previously running code does not execute. I need to reupload the code for it to execute. I was expecting previously flashed code to start running, when power is supplied to the MCU.
I am using a Segger J-link debugger and SWD interface.
I'm quite confident I'm flashing code to FLASH memory, not RAM:
- I have tried using the DEBUG_FLASH as well as the RELEASE_FLASH configurations.
- The Generator_Configurations menu in the Components tab shows that FLASH is the active configuration.
- Going through the project settings, I can see that the *_Flash.ld linker file is in use.
I can replicate this issue across various projects in the workspace. I can also replicate the problem on a fresh workspace. For reference, I've attached the Blinky project, which replicates the problem.
Update: It seems I only have this issue on "S32DS Application Projects", not on "S32DS Project from Examples". I adapted the hello_world_s32k118 project and uploaded it to the board, and the code does work after power-cycling.
I've tried both the "S32DS for ARM" and "S32DS for S32 Platform" versions of the IDE, and this behaviour is consistent across both; only Example Projects work after power-cycling. Clearly there's some configuration difference between my application projects, and the example projects. (I have previously developed on a custom s32k144 board, so I can't imagine what this difference may be)
Regardless, I am attaching "hello_world_s32k118.rar", a project which is persistent across power-cycles.
On the hardware side, the MCU is receiving stable 3.3 volts power supply. The RESET pin (PTA5) is pulled up to 3v3 by a 10k resistor. a 20MHz oscillator is connected across PTB6 and PTB7.
I've attached screenshots to show the project settings and debugger configurations
Debugger Configuration
FLASH configurations selected
Startup Configurations
Linker file, _flash.ld
General Linker settings
FLASH selected in Generator_Configurations
How do I resolve the problem?
Thanks,
Arush