programming app_usb_aud onto eXplorerKit using spi

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
Post Reply
alexjaw
Active Member
Posts: 35
Joined: Wed Jan 24, 2018 9:13 am

programming app_usb_aud onto eXplorerKit using spi

Post by alexjaw »

We would like to program our xcore xuf-216-512 processor from an external mcu using spi. The application is based on app_usb_aud but tailored for our hardware (as a prototype we use eXplorerKit connected to a dsp and a Si5340 dev boards). The problem that we have encountered is how to adapt the instructions from AN00238 SPI Slave Boot Loader to app_usb_aud and its corresponding Makefile.

We have done the following:

* Built and tested app_usb_aud for eXplorerKit. Works just fine.
* Built the files loader_pre_crt.o, loader_init.o and libloader.a for target XE216-512-TQ128-C20 and copied them to app_usb_aud_explorerkit_XE216/src (using xtimecomposer 14.2)
* Added XCC_EXTRA_MAP_FLAGS = ... to app_usb_aud_explorerkit_XE216/src/loader/makefile, as described in AN00238

At this point we get xmake errors when we try to build app_usb_aud with the extra boot loader files. Last part of the build message:

...
Creating app_usb_aud_explorerkit_XE216_2i10o10xxxxxx.xe
../src/loader/loader_pre_crt.S: Error: Multiple definition of 'pll_ctl'
../src/loader/loader_pre_crt.S: Error: first defined here
../src/loader/loader_pre_crt.S: Error: Multiple definition of 'ref_clk_divider'
../src/loader/loader_pre_crt.S: Error: first defined here
../src/loader/loader_pre_crt.S: Error: Multiple definition of 'routing_table'
../src/loader/loader_pre_crt.S: Error: first defined here
xmake[1]: *** [bin/2i10o10xxxxxx/app_usb_aud_explorerkit_XE216_2i10o10xxxxxx.xe] Error 1
xmake: *** [bin/2i10o10xxxxxx/app_usb_aud_explorerkit_XE216_2i10o10xxxxxx.xe] Error 2

Appreciate any suggestions for how this should be handled.

We are also worried about the fact that app_usb_aud Makefile already has some instruction for the map (-Xmapper --map -Xmapper MAPFILE) and that the XCC_EXTRA_MAP_FLAGS might not be compatible with each other.

Have attached the workspace with app_usb_aud for explorerkit.
workspace-xmos14.2.4.zip
(9.32 MiB) Downloaded 183 times
workspace-xmos14.2.4.zip
(9.32 MiB) Downloaded 183 times


User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Hi. Any reason why you are not on the current version of the tool chain?

Also try a clean before building.

Does that change anything on your project?
alexjaw
Active Member
Posts: 35
Joined: Wed Jan 24, 2018 9:13 am

Post by alexjaw »

- loader/loader_pre_crt.S requires nothing higher than 14.2. However, commenting out that requirement and running with 14.3 still generates the same error as above
- Clean does not make any difference

I have managed to build the app with the following flags
BUILD_FLAGS = -DFLASH_MAX_UPGRADE_SIZE=64*1024 -fcomment-asm -Wall -O3 -report -lquadflash -fsubword-select -save-temps -g -fxscope -DXSCOPE -DSDA_HIGH=2 -DSCL_HIGH=1 -DXUD_SERIES_SUPPORT=4 -march=xs2a -DUSB_TILE=tile[1] -DADAT_TX_USE_SHARED_BUFF=1 -DQUAD_SPI_FLASH=1

XCC_EXTRA_MAP_FLAGS = -L/home/alexander/workspace-xmos14.2.4/app_usb_aud_explorerkit_XE216/loader -lloader -Xmapper --first -Xmapper loader_init.o

Besides having removed the original Xmapper stuff from BUILD_FLAGS, I have removed loader_pre_crt.o from the XCC_EXTRA_MAP_FLAGS. I have noticed that loader_pre_crt.S is still used in the build process, since without it loader_init.o would have undefined symbols (pll_ctl, 'ref_clk_divider and routing_table) and that generates corresponding build errors. So, the question now is whether the instructions in loader_pre_crt are correctly handled in the build when the file is removed from XCC_EXTRA_MAP_FLAGS? Is it possible to generate a readable text file (a map file?) to analyze the final output from the linker? Or am I completely lost?

Thanks
AJ
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

alexjaw
Active Member
Posts: 35
Joined: Wed Jan 24, 2018 9:13 am

Post by alexjaw »

great! precisely what I needed.
alexjaw
Active Member
Posts: 35
Joined: Wed Jan 24, 2018 9:13 am

Post by alexjaw »

The problem is: -Xmapper --first -Xmapper loader_pre_crt.o.

Taking away the requirement that the code must be placed first results in a successful build. The loader code appears in the map, but no longer in beginning of the map file. Not much of a boot loader. By some experimentation it turns out that the effect of the Xmapper --first flag is that the build process places the loader code both at start and further down in the .text section. I assume that's why I get the multiple definition error.

I can get a correct map file by manually placing the object files loader_pre_crt.o and loader_init.o in the .build directory. Thus skipping the compilation part of the loader files.

So, the question is how to add boot loader files to app_usb_aud. Files that need to be placed first and only there. Is there a way to tell xcc to skip compilation and just use the object files as they are?
Post Reply