2020-02-15 01:49 AM
I want to bink a led on NUCLEO-G474RE, I used CubeMX and CudeIDE.
Since I don' t want to use IAR or Keil, so I select CubeIDE toolchain in CudeMX.
The code generated and has been opened as project in CubeDE, and the two lines has been added in main():
HAL_GPIO_TogglePin (GPIOB, GPIO_PIN_11);
HAL_Delay (100);
While, when I start to build, this info prompted:
Building in: E:\Blink_G474RE\build\default
make -f ..\..\Makefile
Error: build command 'make' not foundError:
What's wrong with it ?
Should I set the gcc environment variable manually?
I have heard gcc is the default build tool for CubeIDE, is there something I misunderstand ?
2020-02-18 06:22 PM
This solution works.
2020-02-18 06:25 PM
While, now the project met 5 errors:
../Core/Src/main.c: In function 'main':
../Core/Src/main.c:107:3: warning: "/*" within comment [-Wcomment]
/* USER CODE END 3 */
../Core/Src/main.c:167:13: error: invalid storage class for function 'MX_LPUART1_UART_Init'
static void MX_LPUART1_UART_Init(void)
^~~~~~~~~~~~~~~~~~~~
../Core/Src/main.c:213:13: error: invalid storage class for function 'MX_GPIO_Init'
static void MX_GPIO_Init(void)
^~~~~~~~~~~~
../Core/Src/main.c:269:1: error: expected declaration or statement at end of input
}
^
../Core/Src/main.c: At top level:
../Core/Src/main.c:52:13: warning: 'MX_GPIO_Init' used but never defined
static void MX_GPIO_Init(void);
^~~~~~~~~~~~
../Core/Src/main.c:53:13: warning: 'MX_LPUART1_UART_Init' used but never defined
static void MX_LPUART1_UART_Init(void);
^~~~~~~~~~~~~~~~~~~~
../Core/Src/main.c:263:6: warning: 'Error_Handler' defined but not used [-Wunused-function]
void Error_Handler(void)
^~~~~~~~~~~~~
../Core/Src/main.c:213:13: warning: 'MX_GPIO_Init' defined but not used [-Wunused-function]
static void MX_GPIO_Init(void)
^~~~~~~~~~~~
../Core/Src/main.c:167:13: warning: 'MX_LPUART1_UART_Init' defined but not used [-Wunused-function]
static void MX_LPUART1_UART_Init(void)
^~~~~~~~~~~~~~~~~~~~
../Core/Src/main.c:114:6: warning: 'SystemClock_Config' defined but not used [-Wunused-function]
void SystemClock_Config(void)
^~~~~~~~~~~~~~~~~~
arm-none-eabi-gcc "../Core/Src/system_stm32g4xx.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DUSE_HAL_DRIVER -DSTM32G474xx -DDEBUG -c -I../Drivers/STM32G4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Include -I../Drivers/CMSIS/Device/ST/STM32G4xx/Include -I../Core/Inc -I../Drivers/STM32G4xx_HAL_Driver/Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/system_stm32g4xx.d" -MT"Core/Src/system_stm32g4xx.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/system_stm32g4xx.o"
make: *** [Core/Src/subdir.mk:33: Core/Src/main.o] Error 1
make: *** Waiting for unfinished jobs....
"make -j8 all" terminated with exit code 2. Build might be incomplete.
10:16:26 Build Failed. 5 errors, 7 warnings. (took 4s.110ms)
after I added 2 lines here:
/* USER CODE BEGIN 3 */
HAL_GPIO_TogglePin (GPIOB, GPIO_PIN_11);
HAL_Delay (100); /* Insert delay 100 ms *
}
/* USER CODE END 3 */
2020-02-18 06:36 PM
Those errors happened when I click the left button, when I click the right button, no errors and warnings.
and, when I commented these 2 lines:
HAL_GPIO_TogglePin (GPIOB, GPIO_PIN_11);
HAL_Delay (100); /* Insert delay 100 ms *
everything was OK.
2020-02-18 06:41 PM
Thanks, I found the reason:
There was lack of "/" at the end of the second line.
Now alas ist OK.
2020-02-18 06:44 PM
The new question is: could I upload the program inside IDE, or I must use CubeProg ?
2020-02-18 07:10 PM
How to download the code from PC to board, should I use CubeProg ?
2020-02-18 11:04 PM
Many options.
STM32CubeIDE can do it, follow
STM32CubeProg can do it: use the STM32CubeIDE generated .elf file
A Nucleo board also appears as "USB Stick" on you PC. You may drag STM32CubeIDE generated .bin file for programming (flashing), not debugging.
2020-02-19 02:48 AM
2020-02-19 07:20 PM
What's the difference between cproject file and project file ?