Skip to content

Conversation

li-ho
Copy link

@li-ho li-ho commented Apr 20, 2018

Description

  • Rework EV_COG_AD3029LZ linker scripts to support bootloader
  • Rework EV_COG_AD4050LZ linker scripts to support bootloader

Pull request type

  • Fix
  • Refactor
  • New target
  • Feature
  • Breaking change

Edmund Hsu added 3 commits April 20, 2018 15:45
- fix compiler warning message of flash_api.c
- fix compiler warning message of startup_ADuCM4050.c
- eliminate absolute address of ROM tables
- add MBED_APP_START and MBED_APP_SIZE to linker scripts
- fix compiler warning message of flash_api.c
- eliminate absolute address of ROM tables
- add MBED_APP_START and MBED_APP_SIZE to linker scripts
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@li-ho How was this tested? any tests to be shared for this addition?

@li-ho
Copy link
Author

li-ho commented Apr 20, 2018

@0xc0170 They were tested with
https://github.com/armmbed/mbed-os-example-bootloader
and
https://github.com/armmbed/mbed-os-example-bootloader-blinky

"target.restrict_size": "0x20000" for both EV_COG_AD4050LZ and EV_COG_AD3029LZ

The following expansion add-on board:
https://wiki.analog.com/resources/eval/user-guides/ev-gear-expander1z
has the SD card slot, and is required for testing.

If ev-gear-expander1z is not available, mbed-os-example-bootloader-blinky.bin can run straightforwadly.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 20, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Apr 20, 2018

Build : SUCCESS

Build number : 1812
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6690/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Apr 20, 2018

@mbed-ci
Copy link

mbed-ci commented Apr 20, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented May 23, 2018

@li-ho Can you review the latest comment above?

@andrew-mclachlan
Copy link

andrew-mclachlan commented May 23, 2018

Hi @li-ho - logged as #6954.

This may also break GNU ARM Eclipse but haven't tried. Bascially, we're assuming that we can pre-process the LD script which isn't something that GCC Linker supports directly.

@li-ho
Copy link
Author

li-ho commented May 23, 2018

Hi @andrew-mclachlan @0xc0170
I am able to export mbed-os-example-blinky with the following command:
mbed export -i gnuarmeclipse -m ev_cog_ad4050lz
and create mbed-os-example-blinky.bin and mbed-os-example-blinky.elf
gnuarmeclipse_cces280e
gnuarmeclipse can be downloaded from
https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases/download/v4.3.3.20180419-o3a/20180419-1818-gnumcueclipse-4.3.3-oxygen-3a-win32.win32.x86.zip

@andrew-mclachlan
Copy link

Thanks @li-ho. I'll need to check how it is handling your .LD script and when/how it is being pre-processed. Unfortunately the blinky example won't export and build properly with CrossCore Embedded Studio (analog.com/cces).

@andrew-mclachlan
Copy link

ADuCM4050.ld is the right linker script for CCES GCC linker.

Indeed but it contains #defines and CCES (CCES) isn't set up to pre-process the LD script.

@li-ho
Copy link
Author

li-ho commented May 24, 2018

@andrew-mclachlan You can test your cces projects with mbed-os-5.8.3 or older where ADuCM4050.ld does not contain #defines
mbed-os-5 8 3
I have tried CCES 2.8.0 with mbed-os-5.8.3.
cces_softfp
I have also tried CCES 2.8.0 with mbed-os-5.8.5 where ADuCM4050.ld contains #defines, and I get the same error.
Please fix softfp error first with mbed-os-5.8.3.
By the way, can %CCES_HOME% be appended to %PATH% while you install CCES?

@andrew-mclachlan
Copy link

Thanks!!
It definitely seems that we should address the LD issue and the softfp issue (which looks like an exporter issue) so that we can use the later version(s) of mbed-os.

@li-ho
Copy link
Author

li-ho commented May 24, 2018

@andrew-mclachlan The GCC linker of gnuarmeclipse is arm-none-eabi-g++, therefore, #define is readable by GCC linker. You have plenty of toolchain persons on your site to consult with.
Without export,
mbed compile -t gcc_arm -m ev_cog_ad4050lz
can create .link_files.txt and .link_script.ld

@andrew-mclachlan
Copy link

andrew-mclachlan commented May 24, 2018

There's an extra step being done for GNU ARM Eclipse.

CrossCore Embedded Studio just adds the LD script to its Linker command line like so:
arm-none-eabi-g++ -T/home/amclach/mbed-os-example-blinky/cces/../mbed-os/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_GCC_ARM/ADuCM4050.ld -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -mcpu=cortex-m4 -mthumb -specs=nosys.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -o "mbed-os-example-blinky" @input-file.txt -lm
Whereas GNU ARM Eclipse creates several pre-processed versions of the LD script:

"arm-none-eabi-cpp" -E -P -DMBED_DEBUG -DMBED_TRAP_ERRORS_ENABLED=1 -Wl,-n -Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group ../mbed-os/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_GCC_ARM/ADuCM4050.ld -o linker-script-debug.ld "arm-none-eabi-cpp" -E -P -DNDEBUG -Wl,-n -Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group ../mbed-os/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_GCC_ARM/ADuCM4050.ld -o linker-script-release.ld "arm-none-eabi-cpp" -E -P -Wl,-n -Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group ../mbed-os/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_GCC_ARM/ADuCM4050.ld -o linker-script-develop.ld

And then adds the pre-processed LD script to its Link command line.
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -ffunction-sections -fdata-sections -fno-builtin -funsigned-char -fno-delete-null-pointer-checks -fomit-frame-pointer -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g3 -T "/home/amclach/mbed-os-example-blinky/Debug/linker-script-debug.ld" -Xlinker --gc-sections -Xlinker --wrap=main -Xlinker --wrap=_malloc_r -Xlinker --wrap=_free_r -Xlinker --wrap=_realloc_r -Xlinker --wrap=_memalign_r -Xlinker --wrap=_calloc_r -Xlinker --wrap=exit -Xlinker --wrap=atexit -Wl,-Map,"mbed-os-example-blinky.map" -DMBED_DEBUG -DMBED_TRAP_ERRORS_ENABLED=1 -Wl,-n -Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group -o "mbed-os-example-blinky.elf"
The additional step that the GNU ARM Eclipse plugins take to pre-process the LD scripts is not a step that CrossCore Embedded Studio takes.

@li-ho
Copy link
Author

li-ho commented May 24, 2018

In mbed-os\tools\profiles, you can find the corresponding profiles
debug.json
develop.json
release.json
which produce
linker-script-debug.ld
linker-script-develop.ld
linker-script-release.ld
only one of the three is chosen to build.

They are similar to CCES's debug and release configurations. Only one of the two is chosen to build.

@andrew-mclachlan
Copy link

In order to solve this issue with CCES #6954, I need to look at adding pre-processing to the build step and an entry box to accept macro defines for the Linker tool similar to GNU ARM Eclipse plugins.

@andrew-mclachlan
Copy link

CrossCore Embedded Studio (CCES) 2.9.0+ will now pre-process the GCC LD scripts meaning that an ARM mbed project targeting COG boards and exported to CCES will now successfully build.

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 18, 2018

That is great. So just update the studio and all good?

@li-ho
Copy link
Author

li-ho commented Aug 2, 2019

https://download.analog.com/tools/CrossCoreEmbeddedStudio/Releases/Release_2.9.0/ADI_CrossCoreEmbeddedStudio-Rel2.9.0.exe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants