I am developing a bootloader for iMXRT1064 to update the firmware in the inbuilt flash (interfaced through FLEXSPI2). As per my understanding, the bootloader in the bootrom section can be used to perform flash operations (read, erase and program through FLEXSPI2).
When I try to perform any of the flash bootloader operations, I end up in Hardfault - USAFAULT (Usage Fault - UNALIGNED)
However I am not using IAR workbench and building the code by setting up the platform in Visual Code and using boilermake. Lauterbach Trace32 is used for debugging.
The image is built as XIP with the below linker file configurations:
m_flash_config (RX) : ORIGIN = 0x70000000, LENGTH = 0x00001000
m_ivt (RX) : ORIGIN = 0x70001000, LENGTH = 0x00001000
m_interrupts (RX) : ORIGIN = 0x70002000, LENGTH = 0x00000400
m_text (RX) : ORIGIN = 0x70002400, LENGTH = 0x0003DC00
m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000
m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x000C0000
Can you please help what is the configuration that I am missing.