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

make: *** [Makefile:145: build/hover.elf] Error 1 #171

Open
Crowerade opened this issue May 14, 2021 · 5 comments
Open

make: *** [Makefile:145: build/hover.elf] Error 1 #171

Crowerade opened this issue May 14, 2021 · 5 comments

Comments

@Crowerade
Copy link

Hello,
I am on Manjaro and I'm trying to compile the hoverboard-firmware-hack. However, each time in enter 'sudo make' inside the folder, the terminal returns to me this error :

collect2: error: ld returned 1 exit status
make: *** [Makefile:145: build/hover.elf] Error 1
@Brnpimenta
Copy link

hey crowerade,

I got the same error:
cloidnerux#3

any insght to solve it?

regards,

Bruno Oliveira

@jonescb5
Copy link

Seems that three of the "HandleTypeDef" definitions are redefined outside of setup.c and should be proceeded by "extern" rather than re-defined outright. I had this same issue and for me they were:

comms.c:8 : UART_HandleTypeDef huart2;
control.c:17 : DMA_HandleTypeDef hdma_i2c2_rx;
control.c:18 : DMA_HandleTypeDef hdma_i2c2_tx;

I put 'extern' in front of each of those lines in their respective files and it compiled for me. I believe this is because they are defined first in setup.c which is compiled before those two files. By marking them extern we tell the compiler to look for them to already have been defined.

I just got this to compile and have not tested it further so let me know if it works for you guys!

-Chris

@w-A-L-L-e
Copy link

@jonescb5 Indeed same issue here, when compiling today on macOS had to make following patch to get it to compile:

diff --git a/Src/comms.c b/Src/comms.c
index 5e437a1..5e5c323 100644
--- a/Src/comms.c
+++ b/Src/comms.c
@@ -5,7 +5,7 @@
 #include "stdio.h"
 #include "string.h"
 
-UART_HandleTypeDef huart2;
+extern UART_HandleTypeDef huart2;
 
 #ifdef DEBUG_SERIAL_USART3
 #define UART_DMA_CHANNEL DMA1_Channel2
diff --git a/Src/control.c b/Src/control.c
index 9ffdfd2..06247a2 100644
--- a/Src/control.c
+++ b/Src/control.c
@@ -14,8 +14,8 @@ uint8_t nunchuck_data[6] = {0};
 uint8_t i2cBuffer[2];
 
 extern I2C_HandleTypeDef hi2c2;
-DMA_HandleTypeDef hdma_i2c2_rx;
-DMA_HandleTypeDef hdma_i2c2_tx;
+extern DMA_HandleTypeDef hdma_i2c2_rx;
+extern DMA_HandleTypeDef hdma_i2c2_tx;
 
 #ifdef CONTROL_PPM

After that I get a has file in build/hover.hex (also some warnings on readr.c and writer.c from libc/reent).

@GhajariAli
Copy link

I did add extern to those three but still the same error. any idea on the issue?
also there are lots of warnings...

@GhajariAli
Copy link

ok looks like it's nagging about this in the bldc.c but I don't understand what's wrong!
undefined reference to `blockPWM'

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

5 participants