Hello,
I have been trying to run the hello_world application on a colibri iMX8X from the iMX8X M4 JTAG startup guide and am finding that I get a HardFault after it executes the first few lines of SystemInit().
I’ve successfully hooked up a JLink debug interface and started up the tdx-Reference-Multimedia-Image in the A-core. I am on a Viola board, so I’ve soldered breakout wires to the pins 146/144 to access the M4 UART (please tell me if this is correct, as this was the location according to the pin planner. I’d like to change them to a more convenient location but am unfamiliar with the pin indexing from the… boards.h file?) although I’m obviously not seeing anything there. I’m using all the default code from Toradex without really changing anything and I’ve rebooted and followed the JTAG guide twice.
This seems to be something related to the watchdog, as stepping from the start of the program fails when the SysInit function tries to disable the watchdog
697 ldr r0, =VTOR
698 ldr r1, =__isr_vector
699 str r1, [r0]
700 ldr r2, [r1]
701 msr msp, r2
703 ldr r0, =SystemInit
704 blx r0
System Init () at /home/$USER/cortex-m/devices/MIMX8QX6/system_MIMX8QX6_cm4.c:94
94 SCB->CPACR |= ((3UL << 10 2) | (3UL << 11 * 2)); / set CP10, CP11 Full Access */
98 CM4__WDOG->CNT = WDOG_UPDATE_KEY
99 CM4__WDOG->TOVAL = 0xFFFF
HardFault_Handler () at /home/$USER/cortex-m/devices/MIMXQX6/gcc/startup_MIMX8QX6_cm4.S
899 ldr r0, =HardFault_Handler
900 bx r0
… repeats
I checked the UsageFault Status Register and found that I have an ‘IMPRECISERR’:
print\x *(unit32_t *) 0xE000ED28
$1 = 0x400
I also found the code from that section in the .c file mentioned:
#if ((__FPU_PRESENT == 1) && (__FPU_USED == 1))
SCB->CPACR |= ((3UL << 10 2) | (3UL << 11 * 2)); / set CP10, CP11 Full Access */
#endif
#if (DISABLE_WDOG)
CM4__WDOG->CNT = WDOG_UPDATE_KEY;
CM4__WDOG->TOVAL = 0xFFFF;
CM4__WDOG->CS = (uint32_t)((CM4__WDOG->CS) & ~WDOG_CS_EN_MASK) | WDOG_CS_UPDATE_MASK;
#endif
Perhaps it’s failing somewhere in the CM4__WDOG->CS write? I don’t know what would cause that other than maybe the register being incorrect because I chose the wrong hardware (i.e., trying to write to an address pointer CM4__WDOG->CS that doesn’t exist). It also could be something completely different, as after this the init tries to startup a cache.
Any help is much appreciated. Thanks!