lucysrausch / hoverboard-firmware-hack

New Hoverboard Firmware Hack. Now written from scratch and generally much better.
GNU General Public License v3.0
695 stars 405 forks source link

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

Open Crowerade opened 3 years ago

Crowerade commented 3 years ago

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 commented 3 years ago

hey crowerade,

I got the same error: https://github.com/cloidnerux/hoverboard-firmware-hack/issues/3

any insght to solve it?

regards,

Bruno Oliveira

jonescb5 commented 2 years ago

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 commented 2 years ago

@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 commented 1 year ago

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

GhajariAli commented 1 year ago

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