xmos / lib_awe

AWE Core for xcore
Other
0 stars 1 forks source link

Build and linker failures with XTC 15.3.0 #78

Closed danielpieczko closed 2 weeks ago

danielpieczko commented 3 weeks ago

This job was previously working with XTC 15.2.1, but these failures have appeared after switching to 15.3.0.

Build failure in tests/test_ffs_rpc

[ 96%] Building C object CMakeFiles/test_ffs_rpc.dir/System/Volumes/Data/jenkins/workspace/XMOS_lib_awe_develop/lib_logging/lib_logging/src/debug_printf.c.obj
/System/Volumes/Data/jenkins/workspace/XMOS_lib_awe_develop/lib_awe/lib_awe/src/awe_ffs_rpc.c:21:3: error: use of undeclared identifier 'PORT_SQI_CS'
  PORT_SQI_CS,
  ^
/System/Volumes/Data/jenkins/workspace/XMOS_lib_awe_develop/lib_awe/lib_awe/src/awe_ffs_rpc.c:22:3: error: use of undeclared identifier 'PORT_SQI_SCLK'
  PORT_SQI_SCLK,
  ^
/System/Volumes/Data/jenkins/workspace/XMOS_lib_awe_develop/lib_awe/lib_awe/src/awe_ffs_rpc.c:23:3: error: use of undeclared identifier 'PORT_SQI_SIO'
  PORT_SQI_SIO,
  ^
3 errors generated.
xmake[2]: *** [CMakeFiles/test_ffs_rpc.dir/System/Volumes/Data/jenkins/workspace/XMOS_lib_awe_develop/lib_awe/lib_awe/src/awe_ffs_rpc.c.obj] Error 1

Linker error in tests/test_basic

[100%] Linking C executable ../bin/test_awe_basic.xe
test_awe_basic.c:(.text+0x8e): Error: Meta information ("awe_fwInitSharedHeap.nstackwords") for function "awe_fwInitSharedHeap" cannot be determined.
danielpieczko commented 3 weeks ago

The port definition error occurs with XTC 15.3.0 because platform.h was previously included via one of the lib_xcore header files. From XTC 15.3.0, the lib_xcore header doesn't include it for us.

danielpieczko commented 3 weeks ago

(Unsurprisingly) The linker failure still happens if platform.h is included.

As a simple test for compatibility between static libraries on XTC 15.2.1 and 15.3.0, I have run the simple_libs test in xcommon_cmake where the static library was built using 15.2.1 and then the rest of the application was built and linked with the static library using 15.3.0. This works, so static libraries are not fundamentally broken between XTC versions.

danielpieczko commented 2 weeks ago

This linker failure has been explained: there was a change in lib_xcore in XTC 15.3.0 which resulted in awe_main_wrapper being inlined into the PAR_JOBS, where it previously wasn't inlined with XTC 15.2.1. When a function is inlined, the #pragma stackfunction has no effect and so the stack size is incalculable. The workaround is to explicitly mark the relevant function as noinline.

xross commented 2 weeks ago

This is kinda nasty! good to have "resolved" though.