Help, about bootloader

I am using pixhawk hardware to develop my own flight control program. The bootloader in the previous hardware is PX4. I upgraded the bootloader to the one currently used by ardupilot, and there was a problem. After entering the main program, my program no longer runs. Among them, I found 1 reason, because my main program does not have a CAN driver, which caused the bootloader to jump. It crashes. After I modified this problem, the bootloader jumped to the main program normally, but my program could not be scheduled (my program uses RT-Thread operating system).
Eventually I found that the problem occurred in the chSysLock() call of the bootloader jump function. I don’t know what this function does, but it affects the scheduling of my program. I commented out the chSysLock() function and it works fine, but it is not a good solution. Does anyone have experience in this area? Can you help me, thank you!