Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building with LTO=1 is broken #207

Closed
opsound opened this issue Mar 19, 2017 · 0 comments
Closed

Building with LTO=1 is broken #207

opsound opened this issue Mar 19, 2017 · 0 comments
Milestone

Comments

@opsound
Copy link
Contributor

opsound commented Mar 19, 2017

Building with make clean; make -j8 TARGET=CF2 LTO=1 yields the following warnings/errors:

src/drivers/interface/ws2812.h:5:6: warning: type of 'ws2812Send' does not match original declaration [-Wlto-type-mismatch]
 void ws2812Send(uint8_t (*color)[3], uint16_t len);
      ^
src/drivers/src/ws2812_cf2.c:172:6: note: type mismatch in parameter 2
 void ws2812Send(uint8_t (*color)[3], int len)
      ^
src/drivers/src/ws2812_cf2.c:172:6: note: type 'int' should match type 'uint16_t'
/Users/stro/.local/share/gcc-arm-none-eabi/arm-none-eabi/include/sys/_stdint.h:36:20: note: the incompatible type is defined here
 typedef __uint16_t uint16_t ;
                    ^
src/drivers/src/ws2812_cf2.c:172:6: note: 'ws2812Send' was previously declared here
 void ws2812Send(uint8_t (*color)[3], int len)
      ^
src/drivers/src/ws2812_cf2.c:172:6: note: code may be misoptimized unless -fno-strict-aliasing is used
/var/folders/z_/vk4r28_515s8wx74gvlq84_w0000gn/T//ccivFwGD.ltrans15.ltrans.o: In function `PendSV_Handler':
<artificial>:(.text+0x466): undefined reference to `vTaskSwitchContext'
collect2: error: ld returned 1 exit status
make: *** [cf2.elf] Error 1
rm version.c

These changes get it to build cleanly:

diff --git a/src/drivers/src/ws2812_cf2.c b/src/drivers/src/ws2812_cf2.c
index 6d5d521..c946d2c 100644
--- a/src/drivers/src/ws2812_cf2.c
+++ b/src/drivers/src/ws2812_cf2.c
@@ -169,7 +169,7 @@ static int current_led = 0;
 static int total_led = 0;
 static uint8_t (*color_led)[3] = NULL;

-void ws2812Send(uint8_t (*color)[3], int len)
+void ws2812Send(uint8_t (*color)[3], uint16_t len)
 {
     int i;
        if(len<1) return;
diff --git a/src/lib/FreeRTOS/tasks.c b/src/lib/FreeRTOS/tasks.c
index 11ca0e9..6adf9db 100644
--- a/src/lib/FreeRTOS/tasks.c
+++ b/src/lib/FreeRTOS/tasks.c
@@ -2200,7 +2200,7 @@ BaseType_t xSwitchRequired = pdFALSE;
 #endif /* configUSE_APPLICATION_TASK_TAG */
 /*-----------------------------------------------------------*/

-void vTaskSwitchContext( void )
+void __attribute__((used)) vTaskSwitchContext( void )^M
 {
        if( uxSchedulerSuspended != ( UBaseType_t ) pdFALSE )
        {
opsound added a commit to opsound/crazyflie-firmware that referenced this issue Mar 19, 2017
@ataffanel ataffanel added this to the Next version milestone Apr 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants