PlatformIO Community

STM32 platform conflictions


#1

I recieve errors on the Bluepill C108 STM32 board with the STM32RTC libary for the internal real time clock. It throws many errors regarding “tm” structs that have incomplete types.

I am unsure if this is because the libary on its github page states it needs the arduino core stm32 package by stm32duino, or is it just a libary error. Right now it says it only needs the ST STM32 platform which I have and works fine. But when I use the libary it doesnt compile.

Thanks for any and all responces!


#2

Share your code and platfromio.ini please. It might also just be that the board you use uses the Maple core by default, which makes it incompatible with the library.


#4

Platformio.ini

[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino

Code itself:

 #include <Arduino.h>
 #include <STM32RTC.h>

STM32RTC& rtc = STM32RTC::getInstance();

void initTime() {
  rtc.begin();
  //DCF.Start();
  rtc.setTime(14, 0, 0);
  rtc.setDate(23,4,19);
}

void smallDisplay() {
  uint8_t hour, minute, second;
  hour = rtc.getHours();
  minute = rtc.getMinutes();
  second = rtc.getSeconds();
  display.showNumberDec(second);
}

void setup()
{
  // put your setup code here, to run once:
  display.setBrightness(7);
  initTime();
}

void loop()
{
  // put your main code here, to run repeatedly:
  //DCFtime = DCF.getTime(); // Check if new DCF77 time is available
  //indexA.setIndex(second());
  //indexA.execute();
  smallDisplay();
}

Its basically just like the demos from the libary the code should definetly work but yeah I think you might be right about the wrong board choice in platformio.ini. But I have no idea which other board to select, at first I used a generic STM32 with the right microprocessor the bluepill has but that didnt allow me to use all the pins so I use this one. Since im able to use all the pins with a correct order I assumed it might be the right board but ill give some maple boards a try.

Thanks.


#5

Your project compiles fine for me…

[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
lib_deps = STM32duino RTC

and your code with calls to the “display” commentend out:

Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [          ]   4.4% (used 892 bytes from 20480 bytes)
PROGRAM: [==        ]  17.4% (used 11432 bytes from 65536 bytes)
 [SUCCESS] Took 7.54 seconds 

What is the exact error message of the compiler? Are you up-to-date on the platforms? (pio platform update)


#6

Definetly up to date I check that often, But thanks a lot for trying it, this proves the problem is local, ill try to reinstall the libary.

The compiler errors goes like this:

just lots and lots of these:
aggregate ‘tm tm’ has incomplete type and cannot be defined
invalid use of incomplete type ‘struct tm’


#7

This is odd, I tried to reinstall the lib, clean the project files, rebuild the intellisense, nothing worked, still the same error.


#8

Does pio platform update update your ststm32 platform? Which OS are you using? You can also try deleting your <home folder>/.platformio/packages/toolchain-gccarmnoneeabi, framework-arduinoststm32 and platforms/ststm32 folders so that they get freshly reinstalled.


#9

It says it is up to date with all the frameworks, I am running windows 10. I will try to do the fresh reinstall in your way, thanks!


#10

It didnt work.

I did have a extra framework-arduinoststm32-maple folder which I deleted and this one didnt download back. Other projects work without it and dont seem to miss it.


#11

Can you do a

pio run -t clean && pio run > build_log.txt 2>&1

in a console and upload the result to pastebin.com. (You won’t see any output until the command is completed)


#12

It did wait till i get another line confirming the command is complete but there is no output. I searched for the build_log.txt and got none too. Should i be in a project directory, or do this over the windows console instead of the VScode one


#13

just saw the new command ill give it a go


#14

Should be executed in a PIO terminal in VSCode inside the project’s directory (http://docs.platformio.org/en/latest/ide/vscode.html#platformio-toolbar)


#15
At line:1 char:18
+ pio run -t clean && pio run > build_log.txt 2>&1
+                  ~~
The token '&&' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine

#16

Oh it’s a powershell? Then execute the two commands seperately.


#17

Yeah just realized theyre separate commands, is platformio using the default terminal program? I have powershell set as default for the convenience of code completion. If I were to change the default to cmd would platformio use cmd?


#18

Nah doesn’t change anything in what shell pio is invoked, must work either way.


#19

Succesful clean ^

Done cleaning
== [SUCCESS] Took 1.40 seconds ==
PS C:\Users\Ivan\Documents\PlatformIO\Projects\mechanical_clock> pio run > build_log.txt 2>&1
PS C:\Users\Ivan\Documents\PlatformIO\Projects\mechanical_clock>

Thats all the output im recieving, it does take some time so it is doing something.


#20

So build_log.txt is empty or not existent?

Might also try

& pio run 2>&1 >> build_log.txt

#21

Still no resoult, and non existent.

When I run pio run > build_log.txt only, I recieve the same error messages as in compile. Is that what youd want or is it supposed to do something else?