Use XIP with CMake and Linker Scripts

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Use XIP with CMake and Linker Scripts

ソリューションへジャンプ
1,020件の閲覧回数
Geiger8759
Contributor III

Hi all, 

We have an exiqting project which we compiled with MCUXpresso and now we want to migrate to a CMake build in order to do some CICD on our servers.

I've got everything compiling and linking, but the code fails when flashed to the board when doing flash operations, it seems to be related to flexspi_nor_flash operations and I have a suspicion that the XIP is not correctly configured.

These are our link options:

target_link_options(${EXECUTABLE} PRIVATE
  -mcpu=cortex-m7
  -mfpu=fpv5-d16
  -mfloat-abi=hard 
  -mthumb
  -nostdlib
  -Wl,--undefined=FreeRTOSDebugConfig,-Map=${EXECUTABLE_OUTPUT_PATH}/${PROJECT_NAME}.map,--sort-section=alignment,--gc-sections
  -Wl,--cref
  -Xlinker -print-memory-usage -Xlinker
  -v
  -L "${CMAKE_SOURCE_DIR}/ld"
  -T "${LINKER_FILE}"
)

 
With the ld folder containing the linker files as generated by MCUXpresso, and the linker file being project_name_Debug.ld. 

FYI: We have extra linker script input sections configured in MCUXpresso using the project settings in the IDE, which generates the linkscripts folder.  But as I understand it, these are used to generate the .ld files so this should not be the issue. (I can also see the sections in the ld file).

The reason I suspect I'm doing something wrong with XIP, is because I include the xip-directory & source files in the build, but I fail to see how they are used or referenced in the code or linker file.

Can someone clarify this for me?
Any ideas?

xip folder contains:
- fsl_flexspi_nor_boot.c & .h
- evkmimxrt1064_flexspi_nor_config.c & .h

Thanks in advance!

0 件の賞賛
返信
1 解決策
976件の閲覧回数
Geiger8759
Contributor III

Hi @kerryzhou ,

Thank you for the information.

I resolved the issue. 
The problem was that the generated linker file (ld file generated by MCUXpressso) expects the cmake files to have a .o extension, whereas in my case these have the extension .c.obj.

Adjusting this in the ld file fixed the issue.

Thanks for the support!

元の投稿で解決策を見る

2 返答(返信)
977件の閲覧回数
Geiger8759
Contributor III

Hi @kerryzhou ,

Thank you for the information.

I resolved the issue. 
The problem was that the generated linker file (ld file generated by MCUXpressso) expects the cmake files to have a .o extension, whereas in my case these have the extension .c.obj.

Adjusting this in the ld file fixed the issue.

Thanks for the support!

991件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Geiger8759 ,

  Please check my document at first:

https://community.nxp.com/t5/i-MX-RT-Knowledge-Base/RT-Linux-SDK-build-based-on-Ubuntu/ta-p/1690185

chapter 3.3 Code configuration

It will help to add the XIP header or not in the project, you also can check your generated app.srec or hex, or bin, to check whether it contains the FCB to boot or not.

If you use the debugger to download the app image, you need to let the image also contains the FCB for booting.

 

Wish it helps you!

If you still have question about it, please kindly let me know.

Best Regards,

Kerry