USB Stack Linker Script Modification for USB CDC VCOM Implementation

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

USB Stack Linker Script Modification for USB CDC VCOM Implementation

2,243 Views
flyrobot
Contributor I

Hi,

I am tring to  add usb cdc vcom in the soem_gpio_pulse_freertos example.

 

My setup is:

win11, armgcc, MCUXpresso for VSCode, SDK_2_13_0_MIMXRT1061xxxxB, evkmimxrt1060.

 

I copy all the necessary file and change the CMakeList and then compile successfully. But the usb port is not showing up in the PC. It is strange beacuse I have tested the porting in hello world project and get everything works fine.

 

I compared the two demo project and find out the difference in the linker script "MIMXRT1062xxxxx_flexspi_nor.ld" .

 

In the demo "dev cdc vcom freertos", the .bss is located in m_data.

But in the demo "soem_gpio_pulse_freertos ", the .bss is located in m_data2. I tried to modify it to m_data then get a error, the ram size is not enough. 

 

 

I checked the "MCUXpresso SDK USB Stack User’s Guide" and find maybe the "USB_GLOBAL_DEDICATED_RAM" shoud be set. But there is no demo project about how to do it.

 

As a noob in linker script, I am seeking assistance to successfully complete this porting process.

 

Thank you in advance for your time and support.

 

0 Kudos
Reply
5 Replies

1,807 Views
patriciocohen
Contributor IV

Hi,

Any update on this topic?

I'm very interested in this too.

Thanks.

Patricio

0 Kudos
Reply

2,184 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @flyrobot,

The following blog post does a great job explaining how to manage the linker script in order to manually move parts of the code to the desired memory spaces. Please look into it: https://mcuoneclipse.com/2021/05/26/placing-code-in-sections-with-managed-gnu-linker-scripts/

Please let me know if you have further inquiries about this.

BR,
Edwin.

0 Kudos
Reply

2,134 Views
flyrobot
Contributor I

Hi @EdwinHz 

 

I found that if I comment out the "BOARD_ConfigMPU()"  in the main function, the usb works correctly. Can I just use it without the BOARD_ConfigMPU setup?   

 

I guess not only the linker script but also the "BOARD_ConfigMPU()"  should be changed together.

I am still confused about why the usb function is effected by the memory location and mpu setttings.

0 Kudos
Reply

2,120 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @flyrobot,

I would not recommend you to disable MPU, as it provides a protection layer for the memory, but is also capable if improving performance for the managed memory. I would advice you to look into the specific part of the BOARD_ConfigMPU() function and look for what part is causing conflicts on the porting process, and go from there. You can look into https://www.nxp.com/docs/en/application-note/AN12042.pdf for more information about the MPU and the memory types for your application.

BR,
Edwin.

0 Kudos
Reply

2,148 Views
flyrobot
Contributor I

Hi @EdwinHz 

The blog does a great job explaining the basic usage of linker script . But my problem still remains. It does not cover the USB part.

 

I don't know how to set the "USB_GLOBAL_DEDICATED_RAM"  mentioned in "MCUXpresso SDK USB Stack User’s Guide". The default value is to use "USB_LINK_USB_GLOBAL_BSS" and "

USB_LINK_USB_BDT_BSS". 
 
More detail instruction is needed.
 
Thanks,
0 Kudos
Reply