I've been building a test application, and it's gotten bigger and bigger over time. Everything compiles perfectly. I'm building the ns version for the app core. nrf5340dk_nrf5340_cpuappns
It's not that big yet:
Memory region Used Size Region Size %age Used
FLASH: 33072 B 960 KB 3.36%
SRAM: 4744 B 480 KB 0.97%
IDT_LIST: 0 GB 2 KB 0.00%
I put a breakpoint in the SPM at spm_jump() just for fun
I debug and it stops at spm_jump() and then goes to my code. Everything was working well.
I did something like this
And everything runs, it went from the spm to my code and runs. I'm simplifying here, function1 actually read from the i2c bus, but it all worked. function2 sent data to a spi device and programmed it, 17 different registers, read back it all worked.
I added spiread function and as you see it, it worked.
BUT... when I do this?
Suddenly, the spm runs, and nothing gets printed and it immediately comes back to the spm, like the device rebooted. My breakpoint on the spm_jump() stops there, I hit continue and it stops there again and again and again. It never printk's anything. I comment out the printk line in my spiread function, it works again and I get all the output from my code.
If I pass a pointer to the variable dataCounter, it fails. Pass by value? Works. If I try to change the spiread() function to return a variable like the counter I defined? fails. The spm always runs. I put breakpoints in my code, but they never get executed. I never get my ------- Starting ----- message.
This is my proj.conf
But what would cause an immediate crash of my application code by just adding some more things to a function like this. I know I simplified the other functions a lot, but they work fine when I don't try to print from the spiread() function. That one I'm not simplifying. The whole program seems to crash or not get out of the spm when I add the simplest things.
Any thoughts?