Problems with ble_freertos_amdtps example for artemis thing plus board

Hi,

i am using the AMbiqSDK and apollo3 BSPs git from sparkfun (updated), and i copied the files from the folder …/boards/apollo3_evb/examples/ble_freertos_amdtps into the …/AMbiqSuiteSDK/boards_sfe/artemis_thing_plus_examples/ble_freertos_amdtps folder. I updated the Makefile file and, using the asb_linker script, the following error appears when executing make:

...
Compiling gcc startup_gcc.c
 Linking gcc bin/ble_freertos_amdtps_asb.axf with script ../../../../common/tools_sfe/templates/asb_linker.ld
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: bin/ble_freertos_amdtps_asb.axf section `.stack' will not fit in region `sram'
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: region `sram' overflowed by 11000 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:319: bin/ble_freertos_amdtps_asb.axf] Error 1

The lines from the Makefile related to the asb_linker are the following:

$(CONFIG)/$(TARGET)_asb.axf: LINKER_FILE = ../../../../common/tools_sfe/templates/asb_linker.ld 
$(CONFIG)/$(TARGET)_asb.axf: $(OBJS) $(LIBS)
	@echo " Linking $(COMPILERNAME) $@ with script $(LINKER_FILE)";\
	$(CC) -Wl,-T,$(LINKER_FILE) -o $@ $(OBJS) $(LFLAGS)

However, in case I comment the line ```
$(CONFIG)/$(TARGET)_asb.axf: LINKER_FILE = …/…/…/…/common/tools_sfe/templates/asb_linker.ld


Thanks

![error.jpg|1125x458](upload://dJJFqRO6jkUtDZHq45cba5tUOxT.jpeg)

for what its worth: From Working amdtps makefile for Nano…

$(CONFIG)/$(TARGET)_asb.axf: LINKER_FILE = $(COMMONPATH)/tools_sfe/templates/asb_linker.ld

$(CONFIG)/$(TARGET)_asb.axf: $(OBJS) $(LIBS)

@echo " Linking $(COMPILERNAME) $@ with script $(LINKER_FILE)";\

$(CC) -Wl,-T,$(LINKER_FILE) -o $@ $(OBJS) $(LFLAGS)

file = https://github.com/kerryeven/AndroidArt … c/Makefile

Hi @KHE, which linker script are you using, asb_linker.ld or ./ble_freertos_amdtps.ld ?. Could you please share the last lines when you make the ble_freertos_amdtps example using this Makefile? Thanks

sorry…didn’t get email regarding request…here is output from end of compile…

Compiling gcc startup_gcc.c

Linking gcc bin/ble_freertos_amdtps_asb.axf with script …/…/…/…/common/tools_sfe/templates/asb_linker.ld

Copying gcc bin/ble_freertos_amdtps_asb.bin…

Hi there guys - you are probably aware of this post: viewtopic.php?f=168&t=51993

As for linkers… In the working freertos example I chose to use the original linker script from the Apollo3 EVB. For the SVL the only modification required was to change the offset of FLASH memory to 0x10000 (from 0xC000)

Hi @liquid.soulder … in case i copy the original linker script from the ble_cordio_tag example folder for Apollo3 EVB , and i modified it according to your post, it get compiled, linked and uploaded successfully by using make bootload_svl. Great! … however, in case i use the asb_svl_linker.ld script from boards_sfe/common/tools_sfe/templates/asb_svl_linker.ld, it fails and the following error is reported:

Compiling gcc startup_gcc.c
 Linking gcc ../gcc/bin/ble_cordio_tag_svl.axf with script ../../../../common/tools_sfe/templates/asb_svl_linker.ld
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: ../gcc/bin/ble_cordio_tag_svl.axf section `.stack' will not fit in region `sram'
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: region `sram' overflowed by 11000 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:444: ../gcc/bin/ble_cordio_tag_svl.axf] Error 1

Does it make sense to you? … can the asb_linker.ld / asb_svl_linker.ld files provided into the boards_sfe folder have some error?. Thanks for your help!

Makefile.txt (19 KB)I was successful (after 2 full days) of moving the amdtps example from the new SDK 2.3 to boards_sfe using liquid’s new makefile strategy. I basically modified the tag makefile a little to create the attached makefile. Here are the steps and the makefile will be attached with .txt on end (as I can’t figure out how to upload file with no extension):

AMSDK example to Spark Fun boards_sfe conversion

  1. Copy ble_freertos_amdtps directory from SDK/boards/apollo3_evb/examples/ to SDK/boards_sfe/common/examples

  2. SDK/boards_sfe/common/examples/ble_freertos_amdtps delete iar and keil directories

  3. SDK/boards_sfe/common/examples/ble_freertos_tag/gcc copy ble_freertos_tag_asb.ld and ble_freertos_tag_svl.ld to the SDK/boards_sfe/common/examples/ble_freertos_amdtps /gcc directory.

  4. Download attached Makefile (rename to remove .txt extension) and replace SDK/boards_sfe/common/examples/ble_freertos_amdtps /gcc/Makefile with this downloaded Makefile.

  5. From git bash terminal cd to SDK/boards_sfe/common/examples/ble_freertos_amdtps/gcc

  6. For example edge2 board: type EDGE=edge2

  7. type make BOARD=$EDGE

  8. will compile to final copy to bin with last line looking like:

Copying gcc …/gcc/edge2/bin/ble_freertos_amdtps_asb.bin…

  1. make BOARD=EEDGE bootload_svl will load the board if on COM4 (change in Makefile)

  2. if problem with bootload_svl, try bootload_asb. If ever successful with booload_svl, may need to reset board in Arduino with Tools / Burn Bootloader (Programmer: Ambiq Secure Bootloader)

Makefile.txt (19 KB)

oops…#9 should be BOARD=$EDGE not EEDGE…sorry

Hi @KHE, thanks a lot for your help & support. As soon as i can check it, i will post my results. Thanks.

opps again…#10 should be: if ever successful with bootload_asb …

Hi @KHE, just an small change. In step 3), it is requierd to rename the file ble_freertos_tag_asb.ld to ble_freertos_amtdps_asb.ld, and the file ble_freertos_tag_svl.ld to ble_freertos_amtdps_svl.ld . I’ve checked it, and following the steps you provide, i successfully made ble_freertos_amtpds example work in my artemis thing plus board. Thanks!

oops #3…good thing I’m not a banker…Thank you fbtobajas

so with corrections…

AMSDK example to Spark Fun boards_sfe conversion

  1. Copy ble_freertos_amdtps directory from SDK/boards/apollo3_evb/examples/ to SDK/boards_sfe/common/examples

  2. SDK/boards_sfe/common/examples/ble_freertos_amdtps delete iar and keil directories

  3. SDK/boards_sfe/common/examples/ble_freertos_tag/gcc copy ble_freertos_tag_asb.ld and ble_freertos_tag_svl.ld to the SDK/boards_sfe/common/examples/ble_freertos_amdtps /gcc directory. Rename the file ble_freertos_tag_asb.ld to ble_freertos_amtdps_asb.ld, and the file ble_freertos_tag_svl.ld to ble_freertos_amtdps_svl.ld .

  4. Download attached Makefile (rename to remove .txt extension) and replace SDK/boards_sfe/common/examples/ble_freertos_amdtps /gcc/Makefile with this downloaded Makefile.

  5. From git bash terminal cd to SDK/boards_sfe/common/examples/ble_freertos_amdtps/gcc

  6. For example edge2 board: type EDGE=edge2

  7. type make BOARD=$EDGE

  8. will compile to final copy to bin with last line looking like:

Copying gcc …/gcc/edge2/bin/ble_freertos_amdtps_asb.bin…

  1. make BOARD=$EDGE bootload_svl will load the board if on COM4 (change in Makefile)

  2. if problem with bootload_svl, try bootload_asb. If ever successful with booload_asb, may need to reset board in Arduino with Tools / Burn Bootloader (Programmer: Ambiq Secure Bootloader)

MAY HAVE TO RENAME BOARD DIRECTORY NAME TO REMOVE UNDERSCORES…

FYI … Link Problem with redboard_artemis_nano: compiled but wouldn’t link ‘till renamed boards_sfe/redboard_artemis_nano directory to boards/sfe/nano, then it worked fine.

Underscores causing the problem. I renamed board directory to 123456789012345678901 and it worked . 12345678_9012345_6789 had the same error.therefore underscore problem, not length.

Error when NANO=redboard_artemis_nano was used:

Linking gcc …/gcc/redboard_artemis_nano/bin/ble_freertos_amdtps_asb.axf with script …/…/…/…/common/examples/ble_freertos_amdtps/gcc/ble_freertos_amdtps_asb.ld

arm-none-eabi-gcc.exe: error: …/…/…/…/redboar: No such file or directory

make: *** [Makefile:505: …/gcc/redboard_artemis_nano/bin/ble_freertos_amdtps_asb.axf] Error 1

using ARM Gnu 8 2018-q4-major