@sstcor , Below is a sample flash script using blhost — NXP’s command-line tool for communicating with the bootloader — to fully erase and program the flash on an MCXN236 via ISP mode (UART or USB, depending on your setup).
1. Full Chip Erase via ISP (blhost script)
# Connect via UART or USB first # Replace COMx with your serial port (e.g., COM3 on Windows or /dev/ttyUSB0 on Linux) blhost -p COMx,115200 -- get-property 1 blhost -p COMx,115200 -- flash-erase-all
If this works, your flash is now clean.
2. Flashing New Firmware (GUI.bin)
blhost -p COMx,115200 -- write-memory 0x00000000 GUI.bin blhost -p COMx,115200 -- execute 0x00000000
This writes your firmware to the start of flash (address 0x00000000) and then tells the MCU to execute from there.
Note: If your GUI.bin is an image from MCUXpresso or GCC, ensure it is a proper binary file and not in ELF or HEX format. If needed, convert with:
arm-none-eabi-objcopy -O binary GUI.elf GUI.bin
3. Quick Image Validity Checklist
Before flashing, check that:
The first 8 bytes of GUI.bin contain a valid stack pointer and reset vector.
You're not configuring any memory regions (e.g., TrustZone, MPU) that might restrict access without properly initializing them.
If Secure Boot is enabled, the image is signed or provisioned correctly.
Would you like me to generate a minimal example main.c that’s safe to flash and test on the MCXN236?
Best Regards,
Ashutosh Nama