Debugging the FRDM IMX93 from VS Code with MCUXpresso

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

Debugging the FRDM IMX93 from VS Code with MCUXpresso

1,142 Views
Shanmugapriya
Contributor II

Hi Team,

I followed the steps in the guide and successfully uploaded the binary using a USB stick. I can now see the "Hello World" output in both VS Code and Tera Term.

I would like to debug the same binary again in VS Code. Could you please advise on the correct procedure?

Do I need to repeat the steps to enter U-Boot and execute the three commands before starting the debug session, or is there a way to begin debugging directly from VS Code without going through the U-Boot process again?

Also advise on the boot switch (SW1) position if there is another way to begin directly.

Please let me know if you need any additional information from my side.

Thank you.

0 Kudos
Reply
5 Replies

1,119 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @Shanmugapriya,


Unfortunately, that isn’t possible.


Any time you modify the code, you need to reload the updated binary into the processor’s memory and start a new debug session.


If needed, you can create an environment variable that allows you to load the binary to the M core with a single command.


Regards,
Chavira

0 Kudos
Reply

1,108 Views
Shanmugapriya
Contributor II

Hi @Chavira,

I understand that when I make small code changes, I need to rebuild and reload the updated binary into the processor’s memory.

I have a few questions and would appreciate your clarification:

  1. Since we can use breakpoints while debugging in VS Code, if I build a binary and flash it to the processor without debugging breakpoints, can I later connect the debugger and set breakpoints from VS Code without reflashing the device? Or is it necessary to rebuild and reload the binary with debugging enabled to use breakpoints?
  2. Additionally, if there is already a binary stored in eMMC memory and I want to debug that same binary, is it possible to do so simply by connecting the J-Link probe and power cable from VS Code? In other words, can we attach the debugger to the existing binary in memory without reflashing it?

Thanks in advance for your guidance.

0 Kudos
Reply

1,086 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @Shanmugapriya,

1) There is no need to reload the binary. You only have to start the M core and then launch the debug session in VS Code.
Please make sure you are using the debug binary rather than the release binary.


2) Yes, if the original code has not changed, you can simply load the existing binary into the M core and start the debug session.


Best regards,
Chavira

0 Kudos
Reply

1,061 Views
Shanmugapriya
Contributor II

Hi @Chavira 

I just want to confirm whether my understanding is correct:
 
1. When you say, “start the M‑core and load the existing binary into the M‑core”, does this refer to running the following three commands?
 
fatload mmc X:1 80000000 hello_world.bin; 
cp.b 0x80000000 0x201e0000 0x10000;
bootaux 0x1ffe0000 0

2. Regarding “debug binary rather than the release binary”
How do we identify which binary is debug and which is release in the project tree?

 

 

0 Kudos
Reply

1,028 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @Shanmugapriya,

 

1) Yes!

2) You can see this information in VS Code (check the attached image)

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2320090%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EDebugging%20the%20FRDM%20IMX93%20from%20VS%20Code%20with%20MCUXpresso%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2320090%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EHi%20Team%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EI%20followed%20the%20steps%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-Processors-Knowledge-Base%2FGetting-Started-with-FRDM-IMX93-and-MCU-LINK-Pro-for-M-Core%2Fta-p%2F2108089%22%20target%3D%22_self%22%3Eguide%3C%2FA%3E%20and%20successfully%20uploaded%20the%20binary%20using%20a%20USB%20stick.%20I%20can%20now%20see%20the%20%22Hello%20World%22%20output%20in%20both%20VS%20Code%20and%20Tera%20Term.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EI%20would%20like%20to%20debug%20the%20same%20binary%20again%20in%20VS%20Code.%20Could%20you%20please%20advise%20on%20the%20correct%20procedure%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EDo%20I%20need%20to%20repeat%20the%20steps%20to%20enter%20U-Boot%20and%20execute%20the%20three%20commands%20before%20starting%20the%20debug%20session%2C%20or%20is%20there%20a%20way%20to%20begin%20debugging%20directly%20from%20VS%20Code%20without%20going%20through%20the%20U-Boot%20process%20again%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EAlso%20advise%20on%20the%20boot%20switch%20(SW1)%20position%20if%20there%20is%20another%20way%20to%20begin%20directly.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EPlease%20let%20me%20know%20if%20you%20need%20any%20additional%20information%20from%20my%20side.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThank%20you.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2322117%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Debugging%20the%20FRDM%20IMX93%20from%20VS%20Code%20with%20MCUXpresso%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2322117%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F258983%22%20target%3D%22_blank%22%3E%40Shanmugapriya%3C%2FA%3E%2C%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E1)%20Yes!%3C%2FP%3E%0A%3CP%3E2)%20You%20can%20see%20this%20information%20in%20VS%20Code%20(check%20the%20attached%20image)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2321043%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Debugging%20the%20FRDM%20IMX93%20from%20VS%20Code%20with%20MCUXpresso%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2321043%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F206761%22%20target%3D%22_blank%22%3E%40Chavira%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3EI%20just%20want%20to%20confirm%20whether%20my%20understanding%20is%20correct%3A%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CDIV%3E1.%20When%20you%20say%2C%20%3CEM%3E%E2%80%9Cstart%20the%20M%E2%80%91core%20and%20load%20the%20existing%20binary%20into%20the%20M%E2%80%91core%E2%80%9D%3C%2FEM%3E%2C%20does%20this%20refer%20to%20running%20the%20following%20three%20commands%3F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Efatload%20mmc%20X%3A1%2080000000%20hello_world.bin%3B%20%0Acp.b%200x80000000%200x201e0000%200x10000%3B%0Abootaux%200x1ffe0000%200%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CSPAN%3E2.%26nbsp%3B%3C%2FSPAN%3ERegarding%20%3CEM%3E%E2%80%9Cdebug%20binary%20rather%20than%20the%20release%20binary%E2%80%9D%3C%2FEM%3E%20%E2%80%94%3CBR%20%2F%3EHow%20do%20we%20identify%20which%20binary%20is%20debug%20and%20which%20is%20release%20in%20the%20project%20tree%3F%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2320773%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Debugging%20the%20FRDM%20IMX93%20from%20VS%20Code%20with%20MCUXpresso%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2320773%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F258983%22%20target%3D%22_blank%22%3E%40Shanmugapriya%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3E1)%20There%20is%20no%20need%20to%20reload%20the%20binary.%20You%20only%20have%20to%20start%20the%20M%20core%20and%20then%20launch%20the%20debug%20session%20in%20VS%20Code.%3CBR%20%2F%3EPlease%20make%20sure%20you%20are%20using%20the%20debug%20binary%20rather%20than%20the%20release%20binary.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E2)%20Yes%2C%20if%20the%20original%20code%20has%20not%20changed%2C%20you%20can%20simply%20load%20the%20existing%20binary%20into%20the%20M%20core%20and%20start%20the%20debug%20session.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EBest%20regards%2C%3CBR%20%2F%3EChavira%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2320524%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Debugging%20the%20FRDM%20IMX93%20from%20VS%20Code%20with%20MCUXpresso%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2320524%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F206761%22%20target%3D%22_blank%22%3E%40Chavira%3C%2FA%3E%2C%3C%2FP%3E%3CP%3EI%20understand%20that%20when%20I%20make%20small%20code%20changes%2C%20I%20need%20to%20rebuild%20and%20reload%20the%20updated%20binary%20into%20the%20processor%E2%80%99s%20memory.%3C%2FP%3E%3CP%3EI%20have%20a%20few%20questions%20and%20would%20appreciate%20your%20clarification%3A%3C%2FP%3E%3COL%3E%3CLI%3ESince%20we%20can%20use%20breakpoints%20while%20debugging%20in%20VS%20Code%2C%20if%20I%20build%20a%20binary%20and%20flash%20it%20to%20the%20processor%20%3CSTRONG%3Ewithout%20debugging%20breakpoints%3C%2FSTRONG%3E%2C%20can%20I%20later%20connect%20the%20debugger%20and%20set%20breakpoints%20from%20VS%20Code%20without%20reflashing%20the%20device%3F%20Or%20is%20it%20necessary%20to%20rebuild%20and%20reload%20the%20binary%20with%20debugging%20enabled%20to%20use%20breakpoints%3F%3C%2FLI%3E%3CLI%3E%3CSPAN%3EAdditionally%2C%20if%20there%20is%20already%20a%20binary%20stored%20in%20eMMC%20memory%20and%20I%20want%20to%20debug%20that%20same%20binary%2C%20is%20it%20possible%20to%20do%20so%20simply%20by%20connecting%20the%20J-Link%20probe%20and%20power%20cable%20from%20VS%20Code%3F%20In%20other%20words%2C%20can%20we%20attach%20the%20debugger%20to%20the%20existing%20binary%20in%20memory%20without%20reflashing%20it%3F%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3EThanks%20in%20advance%20for%20your%20guidance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2320371%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Debugging%20the%20FRDM%20IMX93%20from%20VS%20Code%20with%20MCUXpresso%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2320371%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F258983%22%20target%3D%22_blank%22%3E%40Shanmugapriya%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EUnfortunately%2C%20that%20isn%E2%80%99t%20possible.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EAny%20time%20you%20modify%20the%20code%2C%20you%20need%20to%20reload%20the%20updated%20binary%20into%20the%20processor%E2%80%99s%20memory%20and%20start%20a%20new%20debug%20session.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EIf%20needed%2C%20you%20can%20create%20an%20environment%20variable%20that%20allows%20you%20to%20load%20the%20binary%20to%20the%20M%20core%20with%20a%20single%20command.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ERegards%2C%3CBR%20%2F%3EChavira%3C%2FP%3E%3C%2FLINGO-BODY%3E