I recently got the iMX7D based SABRE board to play with (MCIMX7SABRE), and I'm interested in the M4 side for work.
I needed to set it up to work with existing tools at hand: GDB, Segger J-Link, Eclipse essentially. And using the NXP's supported & provided FreeRTOS and the BSP.
The docs & readme's are good, but I found I had to do some extra setup steps or tweaking to make it work in my setup.
What I referred to or examined :
1. i.MX 7Dual SABRE Board|NXP the Getting Started part
2. Getting_Started_with_FreeRTOS_BSP_for_i.MX_7Dual.pdf (inside FreeRTOS provided BSP package)
3. https://www.nxp.com/docs/en/application-note/AN5317.pdf (that's the key app note really )
4. https://www.nxp.com/docs/en/user-guide/KSDK13GSUG.pdf (referred to under 1))
I found the above enough to connect to M4 and upload a binary blob, but I had to add extra steps to setup the debugging properly. As you will note from 1), 2) , J-Link and GDB (and plain Eclipse ) is not supported in the docs. When going through 1), under "3. FreeRTOS" tab, clicking on "Use ARM GCC" brings up a window with extra information with some required GDB steps, but they are definitely not enough. And at the top of that window you can click on "Download PDF" and get 4), which I found irrelevant: it describes Kinetis SDK, Attolic (which are Eclipse based..),and other IDE's setup for other targets, I didn't see iMX7 or SABRE in that doc. And, it uses OpenSDA, and I don't think the SABRE board I'm using even has it (am I wrong..?). In any case, I've setup it to use J-Linkj through JTAG interface.
The key doc is the appnote in 3), and the Segger's script to connect to M4 of iMX7D referred to in 5) but is also part of standard J-Link install - at least in my Segger version V 6.20b I'm using now.
However, I've modified that Segger's script (see attached) and the appnote (from 3)) process of connecting to M4 and starting to debug. I find, in my testing on this one board with iMX7D and the provided examples (i tested 2), I don't have to do first connect to the A7 to let the M4 go: with the modified reset procedure it seems to work with just the M4 connection.
(So is this spurious .. ? The AN in 3) says you have to first connect to A7 & start M4, and Segger's wiki repeats what the AN says. May be I got 'lucky' ..)
After you've connected to M4, with or without the initial A7 connection to enable M4 (and using or not the customized script or not), the GDB commands required , after you connected to Segger GDBServer, are:
monitor halt // Eclipse: I un-tick Initial Reset & halt and put this under "additional to alternative inits window .. "
// (put whatever else you need, but with customized Segger script initial reset is done on connect)
load // Eclipse does this if you tick enable Load executable
--------------------- // The below goes to Run/Restart Commands, un-tick Pre-Run/Restart reset
mon memU32 0x3039000C 0xAC
eval "monitor memU32 0x00180000 %p", &__stack
eval "monitor memU32 0x00180004 %p", &Reset_Handler + 1
mon memU32 0xE000EDFC 0x01000001
mon memU32 0x3039000C 0xAA
tbreak main //Eclipse tick Set breakpoint at ..
continue //Eclipse tick continue
With Eclipse, using the modified J-Link script, the above steps would be under "Startup" bar.
So with these settings, I'm able to debug on the iMX7D Cortex-M4, using my Segger J-Link, GDB and Eclipse (not Kinetis, Attolic , or DS-5, just Eclipse with GNU ARM plugin)
Anyone else has same tools but sets it up differently? If you don't mind sharing ...
Original Attachment has been moved to: NXP_iMX7D_Connect_CortexM4.JLinkScript.zip