kl25z startup issue on Linux

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

kl25z startup issue on Linux

530 Views
orange757
Contributor I

Hi, 

I am developing a test software to test the interface with UART0 on the KL25Z board on the Linux Ubuntu 17.04 platform using the openOCD debug interface. I have been developing a data processing module using the circular buffer method and then transmit the data from the buffer to the KL25Z board via the UART0 interface. While testing the software on the openOCD interface using the gdb, I have found that the execution process did not go all the way to main() function call. I already set up a temporary breakpoint on gdb to get the execution to stop at main(). 

It seems like everytime I try to execute the .elf executable file on the KL25Z board, it initally makes the call to startup_MKL25Z4.S file. It stops at line 118 Reset_Handler: cpsid i (Mask Interrupts). It seems like it stays stuck there and keep looping in there. It never got past that point. It never got to the main() function call for our software code to start to execute. So, I would need your help on how to get the .elf file to boot up and start to execute from the main() function call. 

How do I get the software to move past "cpsid i" under Reset_Handler? What is the best way to load up the startup_MKL25Z4.S code on the KL25Z using GDB/openOCD debugger set up on the Linux platform? I want to see this software to execute well on the KL25Z from the linux command lines. 

Please help! Thank you so much for your help! By the way, I have attached my screenshots of what I have done so far. 

Brian Kelly 

Attached: 
openocdGDB_startup.jpg - this is the GDB process of loading and starting up the .elf file on the KL25Z board 
openocdGDB_running.png- This is what happens after I type "continue" on GDB. It just stays stuck on Line 118 cpsid i. It just keeps looping in there and never really mvoe past that line. 
openocdGDB_ctrl-c_interrupt.jpg - this is what happens after I type "ctrl-c" to stop the exection on gdb and it called to USB0_IRQinterrupt. when I typed continue, it stays there and never went back to the start. 
gdb_script.png - this is the gdb script that I have used to load the file on the board and then run it. 

startup_MKL25Z4.S info: 
file: startup_MKL25Z4.S 
purpose: CMSIS Cortex-M0P Core Device Startup File 
version: 2.5 
date: 2015-2-19 
build: b150220

Labels (1)
Tags (2)
0 Kudos
1 Reply

353 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Brian Kelly 

Every project has to pass through the Reset_handler, and then go to the initialization part and then jump to main part. This doesn't seams to be a debugger problem but a problem in the program. I would expect that you already test this code with a IDE, if not, please try to first test the project with an IDE and also try to locate the problem in your UART setup, I noticed that you are in the default_IRS handler, It could be that you do not enable the gated clock before you use the peripheral, which leads to the hardfault error.

Hope this could help you.

Best Regards

Jorge Alcala