Hello everyone!
I’m trying to make a little demo and attempt to build results in following error:
Compiling .pioenvs\nucleo_f411re\FrameworkMbed\targets\TARGET_STM\TARGET_STM32F4\TARGET_STM32F411xE\device\TOOLCHAIN_GCC_ARM\startup_stm32f411xe.o
C:\Users\Yehor Pererva\.platformio\packages\framework-mbed\targets\TARGET_STM\TARGET_STM32F4\TARGET_STM32F411xE\device\TOOLCHAIN_GCC_ARM\startup_stm32f411xe.S:1: fatal error: opening dependency file .pioenvs\nucleo_f411re\FrameworkMbed\targets\TARGET_STM\TARGET_STM32F4\TARGET_STM32F411xE\device\TOOLCHAIN_GCC_ARM\startup_stm32f411xe.d: No such file or directory
compilation terminated.
...
Compiling .pioenvs\nucleo_f411re\FrameworkMbed\targets\TARGET_STM\TARGET_STM32F4\device\stm32f4xx_hal_cryp.o
Compiling .pioenvs\nucleo_f411re\FrameworkMbed\targets\TARGET_STM\TARGET_STM32F4\device\stm32f4xx_hal_cryp_ex.o
Compiling .pioenvs\nucleo_f411re\FrameworkMbed\targets\TARGET_STM\TARGET_STM32F4\device\stm32f4xx_hal_dac.o
Compiling .pioenvs\nucleo_f411re\FrameworkMbed\targets\TARGET_STM\TARGET_STM32F4\device\stm32f4xx_hal_dac_ex.o
Compiling .pioenvs\nucleo_f411re\FrameworkMbed\targets\TARGET_STM\TARGET_STM32F4\device\stm32f4xx_hal_dcmi.o
Compiling .pioenvs\nucleo_f411re\FrameworkMbed\targets\TARGET_STM\TARGET_STM32F4\device\stm32f4xx_hal_dcmi_ex.o
*** [.pioenvs\nucleo_f411re\FrameworkMbed\targets\TARGET_STM\TARGET_STM32F4\TARGET_STM32F411xE\device\TOOLCHAIN_GCC_ARM\startup_stm32f411xe.o] Error 1
Compiling .pioenvs\nucleo_f411re\FrameworkMbed\targets\TARGET_STM\TARGET_STM32F4\device\stm32f4xx_hal_dfsdm.o
How to fix hat?
The program purpose was to use rotary encoder of menu navigation.
Target : STM32 NucleoF411RE
Framework : mbed
Platform : ststm32
Programmer : the ST-Link v2.1 build into Nucleo boards
The code is:
#include <mbed.h>
#include <string.h>
// Define pins connected to microcontroller from rotary encoder
#define ENCODER_A PA_10
#define ENCODER_B PB_3
#define ENCODER_SW PB_5
// Define structure of menu "item"
struct menu_item
{
int id; // unique ID
int parentid; // ID of parent object
bool changeable; // if item is changeable
string label; // Caption / label
int value; // Actual numerical value
int min; // minimal value
int max; // maximal value
int increment; // value of increment / decrement
};
int MSM [8] = {1, 2, 4, 8, 16, 32, 64, 128};
// Define size of menu
int menu_total_items = 4;
menu_item menu [menu_total_items] = {
{0, -1, false, "Main", 0, 0, 0, 0},
{1, 0, true, " RPM", 50, 1, 250, 1},
{2, 0, true, " MSM", 0, 0, 8, 1},
{3, 0, true, " SPR", 250, 40, 500, 1}
};
int main() {
// put your setup code here, to run once:
while(1) {
// put your main code here, to run repeatedly:
}
}
Thank you!
P.S. Fore some reason, I receive the same error in other code:
#include <mbed.h>
AnalogIn photo_input(PA_0);
DigitalOut led(PA_10);
int previous_state = 0;
int next_state = 0;
int main() {
led = previous_state;
while(1) {
if (photo_input.read() > 0.5){
next_state = 1;
} else {
next_state = 0;
};
if (previous_state =! next_state){
led = next_state;
previous_state = next_state;
};
};
}
I don’t understand the reason.