Page 1 of 1

IDE 2 rc3 Compiles with Errors and corrupts STM32F4

Posted: Tue Jan 04, 2022 9:47 am
by imk
Hello,
Platform Win10 Pro 64, IDE 2 RC3
Not sure sure if i should be reporting this here or Arduino Forum but think it might be a STM32 variants issue.
So i am in process of building what is going to be a large multi module project on the Black Pile STM32F411CE chip
Currently the project has the .ino, two .cpp and two .h files and i have used almost every pin on the chip including RTC pins as digital out
#define MOTOR_4_CONTROLLER_AB_IN1_PIN PC15
#define MOTOR_4_CONTROLLER_AB_IN2_PIN PC14
These seem to test ok, but in the IDE .cpp file they highlighted with a "Use of Undeclared No Quick Fix" message.

Now the code compiles and build without error and is working as expected.
However sometimes after editing a file the compiler with throw an error then fail to UpLoad the code:

Error: No STM32 target found!
Upload error: Failed uploading: uploading error: exit status 1

After this error I shutdown IDE 2 rc3, restart it and the code compiles just fine.
However the STM32F411CE is damaged and the STLINK throws a cant find error.
So I have to do a Full Chip Erase with STM32CubeProgrammer, then all works just fine.

Below are the two build outputs of what is unchanged code.
This situation seems to happen almost randomly, but generally after a source code change that would compile without error.
eg passing a different integer value as a parameter to a function for testing

^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^- Below Build Normal Output But Damaged Chip ^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-
Sketch uses 24608 bytes (4%) of program storage space. Maximum is 524288 bytes.
Global variables use 4012 bytes (3%) of dynamic memory, leaving 127060 bytes for local variables. Maximum is 131072 bytes.

--------------------------
Compilation complete.
-------------------------------------------------------------------
STM32CubeProgrammer v2.8.0
-------------------------------------------------------------------

ST-LINK SN : 003F002B5553500720393256
ST-LINK FW : V3J8M3
Board : STLINK-V3MINI
Voltage : 3.19V
Error: No STM32 target found!
2nd connect tentative with a lower frequency (8MHz)
ST-LINK SN : 003F002B5553500720393256
ST-LINK FW : V3J8M3
Board : STLINK-V3MINI
Voltage : 3.24V
Error: No STM32 target found!
Upload error: Failed uploading: uploading error: exit status 1
^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^- Above Build Normal Output ^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-

^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^- Below Erroneous Build Error Good Upload ^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-
C:\Users\Me\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.2.0\system/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f411xe.h:371:3: warning: type 'struct RCC_TypeDef' violates the C++ One Definition Rule [-Wodr]
371 | } RCC_TypeDef;
| ^
C:\Users\Me\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.2.0\system/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h:629:3: note: a different type is defined in another translation unit
629 | } RCC_TypeDef;
| ^
C:\Users\Me\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.2.0\system/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f411xe.h:369:17: note: the first difference of corresponding definitions is field 'RESERVED7'
369 | uint32_t RESERVED7[1]; /*!< Reserved, 0x88 */
| ^
C:\Users\Me\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.2.0\system/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h:629:3: note: a type with different number of fields is defined in another translation unit
629 | } RCC_TypeDef;
| ^
C:\Users\Me\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.2.0\cores\arduino/stm32/PinNames.h:280:3: warning: type 'PinName' violates the C++ One Definition Rule [-Wodr]
280 | } PinName;
| ^
C:\Users\Me\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.2.0\cores\arduino/stm32/PinNames.h:280:3: note: an enum with different value name is defined in another translation unit
280 | } PinName;
| ^
C:\Users\Me\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.2.0\cores\arduino/stm32/PinNames.h:164:3: note: name 'PH_0' differs from name 'PF_0' defined in another translation unit
164 | PH_0 = (PortH << 4) + 0x00,
| ^
C:\Users\Me\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.2.0\cores\arduino/stm32/PinNames.h:128:3: note: mismatching definition
128 | PF_0 = (PortF << 4) + 0x00,
| ^
Sketch uses 25212 bytes (4%) of program storage space. Maximum is 524288 bytes.
Global variables use 4012 bytes (3%) of dynamic memory, leaving 127060 bytes for local variables. Maximum is 131072 bytes.

--------------------------
Compilation complete.
-------------------------------------------------------------------
STM32CubeProgrammer v2.8.0
-------------------------------------------------------------------

ST-LINK SN : 003F002B5553500720393256
ST-LINK FW : V3J8M3
Board : STLINK-V3MINI
Voltage : 3.20V
SWD freq : 24000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x431
Revision ID : Rev A
Device name : STM32F411xC/E
Flash size : 512 KBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : 0x__



Memory Programming ...
Opening and parsing file: ERIN_MOTOR_TEST_1.ino.bin
File : ERIN_MOTOR_TEST_1.ino.bin
Size : 25648 Bytes
Address : 0x08000000


Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 1]
Download in Progress:


File download complete
Time elapsed during download operation: 00:00:00.903

RUNNING Program ...
Address: : 0x8000000
Application is running, Please Hold on...
Start operation achieved successfully

--------------------------
upload complete.

^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^- Above Erroneous Build Error Good Upload ^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-

Re: IDE 2 rc3 Compiles with Errors and corrupts STM32F4

Posted: Tue Jan 04, 2022 10:02 am
by fpiSTM
I've met this issue with Arduino IDE 2.0 RC2 but disappear with RC3.
Anyway, I've saw several other issues and they are linked to the IDE. My guess is that there is some issue with build process managed by the IDE.
Cache? multitask,...

You should open an issue to the Arduino IDE repo. With the Arduino 1.8.x no such issue appears.