B4R Question how to compile Arduino_Core_STM32

mzelecom

Member
hi
i want to used Arduino_Core_STM32.
i installed core from

i can compile blink example and it work with Arduino ide .
but in b4r show this error in compile .
B4X:
B4R Version: 3.31
Parsing code.    (0.00s)
Building folders structure.    (0.02s)
Compiling code.    (0.01s)
Building project    (0.03s)
Compiling & deploying Ino project (Generic STM32F0 series - COM5)    Error
Loading configuration...
Initiuserzing packages...
Preparing boards...
Verifying...
2020-08-01T04:47:54.831Z INFO c.a.u.n.HttpConnectionManager:153 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Connect to https://builder.arduino.cc/builder/v1/boards/0x1A86/0x7523, method=GET, request id=1819ED5899B746B1
2020-08-01T04:47:56.425Z INFO c.a.u.n.HttpConnectionManager:157 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Request complete URL="https://builder.arduino.cc/builder/v1/boards/0x1A86/0x7523", method=GET, response code=404, request id=1819ED5899B746B1, headers={null=[HTTP/1.1 404 Not Found], Cache-Control=[no-cache, no-store, must-revuserdate], Server=[nginx], Connection=[keep-userve], Vary=[Origin], Pragma=[no-cache], Expires=[0], Content-Length=[0], Date=[Sat, 01 Aug 2020 04:47:57 GMT]}
2020-08-01T04:47:56.427Z WARN p.a.h.BoardCloudResolver:64 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Fail to get the Vid Pid information from the builder response code=404
C:\Users\user\Desktop\B4R_GP~1\Objects\bin\sketch\B4RArduino.cpp: In member function 'void B4R::Pin::setMode(Byte)':
B4RArduino.cpp:11:3: error: 'WiringPinMode' was not declared in this scope
   11 |   WiringPinMode stm32_Mode;
      |   ^~~~~~~~~~~~~
B4RArduino.cpp:14:5: error: 'stm32_Mode' was not declared in this scope
   14 |     stm32_Mode = INPUT;
      |     ^~~~~~~~~~
B4RArduino.cpp:23:22: error: 'stm32_Mode' was not declared in this scope
   23 |   pinMode(PinNumber, stm32_Mode);
      |                      ^~~~~~~~~~
C:\Users\user\Desktop\B4R_GP~1\Objects\bin\sketch\B4RCore.cpp: In static member function 'static B4R::B4RString* B4R::Common::NumberFormat(Double, byte, byte)':
B4RCore.cpp:396:36: error: call of overloaded 'print(Double&, byte&)' is ambiguous
  396 |   pm.print(Number, MaximumFractions);
      |                                    ^
In file included from C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Stream.h:26,
                 from C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/HardwareSerial.h:29,
                 from C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/WSerial.h:5,
                 from C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/wiring.h:47,
                 from C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Arduino.h:36,
                 from C:\Users\user\Desktop\B4R_GP~1\Objects\bin\sketch\B4RDefines.h:8,
                 from C:\Users\user\Desktop\B4R_GP~1\Objects\bin\sketch\B4RCore.cpp:1:
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:81:12: note: candidate: 'size_t Print::print(unsigned char, int)'
   81 |     size_t print(unsigned char, int = DEC);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:82:12: note: candidate: 'size_t Print::print(int, int)'
   82 |     size_t print(int, int = DEC);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:83:12: note: candidate: 'size_t Print::print(unsigned int, int)'
   83 |     size_t print(unsigned int, int = DEC);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:84:12: note: candidate: 'size_t Print::print(long int, int)'
   84 |     size_t print(long, int = DEC);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:85:12: note: candidate: 'size_t Print::print(long unsigned int, int)'
   85 |     size_t print(unsigned long, int = DEC);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:86:12: note: candidate: 'size_t Print::print(double, int)'
   86 |     size_t print(double, int = 2);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:103:10: note: candidate: 'void Print::print(int64_t, uint8_t)'
  103 |     void print(int64_t, uint8_t = DEC);
      |          ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:105:10: note: candidate: 'void Print::print(uint64_t, uint8_t)'
  105 |     void print(uint64_t, uint8_t = DEC);
      |          ^~~~~
exit status 1

please help.
thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I guess that the API has changed. Edit libraries\rCore\B4RArduino.cpp.

Find this code:
B4X:
#ifdef _VARIANT_ARDUINO_STM32_
        WiringPinMode stm32_Mode;
        switch (arduino_Mode) {
            case INPUT:
                stm32_Mode = INPUT;
                break;
            case OUTPUT:
                stm32_Mode = OUTPUT;
                break;
            case INPUT_PULLUP:
                stm32_Mode = INPUT_PULLUP;
                break;
        }
        pinMode(PinNumber, stm32_Mode);
#else
        pinMode(PinNumber, arduino_Mode);
#endif
Delete everything except of: pinMode(PinNumber, arduino_Mode);

Does it work?
 
Upvote 0

mzelecom

Member
pin mode now ok.but another error show.

B4X:
B4R Version: 3.31
Parsing code.    (0.00s)
Building folders structure.    (0.01s)
Compiling code.    (0.00s)
Building project    (0.02s)
Compiling & deploying Ino project (Generic STM32F0 series - COM5)    Error
Loading configuration...
Initiuserzing packages...
Preparing boards...
Verifying...
C:\Users\user\Desktop\NEWFOL~3\Objects\bin\sketch\B4RCore.cpp: In static member function 'static B4R::B4RString* B4R::Common::NumberFormat(Double, byte, byte)':
B4RCore.cpp:396:36: error: call of overloaded 'print(Double&, byte&)' is ambiguous
  396 |   pm.print(Number, MaximumFractions);
      |                                    ^
In file included from C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Stream.h:26,
                 from C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/HardwareSerial.h:29,
                 from C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/WSerial.h:5,
                 from C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/wiring.h:47,
                 from C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Arduino.h:36,
                 from C:\Users\user\Desktop\NEWFOL~3\Objects\bin\sketch\B4RDefines.h:8,
                 from C:\Users\user\Desktop\NEWFOL~3\Objects\bin\sketch\B4RCore.cpp:1:
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:81:12: note: candidate: 'size_t Print::print(unsigned char, int)'
   81 |     size_t print(unsigned char, int = DEC);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:82:12: note: candidate: 'size_t Print::print(int, int)'
   82 |     size_t print(int, int = DEC);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:83:12: note: candidate: 'size_t Print::print(unsigned int, int)'
   83 |     size_t print(unsigned int, int = DEC);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:84:12: note: candidate: 'size_t Print::print(long int, int)'
   84 |     size_t print(long, int = DEC);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:85:12: note: candidate: 'size_t Print::print(long unsigned int, int)'
   85 |     size_t print(unsigned long, int = DEC);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:86:12: note: candidate: 'size_t Print::print(double, int)'
   86 |     size_t print(double, int = 2);
      |            ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:103:10: note: candidate: 'void Print::print(int64_t, uint8_t)'
  103 |     void print(int64_t, uint8_t = DEC);
      |          ^~~~~
C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Print.h:105:10: note: candidate: 'void Print::print(uint64_t, uint8_t)'
  105 |     void print(uint64_t, uint8_t = DEC);
      |          ^~~~~
exit status 1
 
Upvote 0

mzelecom

Member
i commenting that line and compile .it is ok and another error show.

B4X:
B4R Version: 3.31
Parsing code.    (0.00s)
Building folders structure.    (0.03s)
Compiling code.    (0.00s)
Building project    (0.03s)
Compiling & deploying Ino project (Generic STM32F0 series - COM5)    Error
Loading configuration...
Initiuserzing packages...
Preparing boards...
Verifying...
2020-08-03T07:32:41.168Z INFO c.a.u.n.HttpConnectionManager:153 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Connect to https://builder.arduino.cc/builder/v1/boards/0x1A86/0x7523, method=GET, request id=173DB229AFE14083
2020-08-03T07:32:42.618Z INFO c.a.u.n.HttpConnectionManager:157 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Request complete URL="https://builder.arduino.cc/builder/v1/boards/0x1A86/0x7523", method=GET, response code=404, request id=173DB229AFE14083, headers={null=[HTTP/1.1 404 Not Found], Cache-Control=[no-cache, no-store, must-revuserdate], Server=[nginx], Connection=[keep-userve], Vary=[Origin], Pragma=[no-cache], Expires=[0], Content-Length=[0], Date=[Mon, 03 Aug 2020 07:32:42 GMT]}
2020-08-03T07:32:42.620Z WARN p.a.h.BoardCloudResolver:64 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Fail to get the Vid Pid information from the builder response code=404
c:/users/user/appdata/local/arduino15/packages/stm32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\user\Desktop\NEWFOL~3\Objects\bin/src.ino.elf section `.text' will not fit in region `FLASH'
c:/users/user/appdata/local/arduino15/packages/stm32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 6748 bytes
collect2.exe: error: ld returned 1 exit status
exit status 1
 
Upvote 0

mzelecom

Member
yes i create new project but i get error.
8-3-2020 1-45-56 PM.png
 
Upvote 0

mzelecom

Member
with Arduino IDE .
stm32f0 show this error.i think flash limit caused this error.

B4X:
c:/users/user/appdata/local/arduino15/packages/stm32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\user\AppData\Local\Temp\arduino_build_573630/src.ino.elf section `.text' will not fit in region `FLASH'

c:/users/user/appdata/local/arduino15/packages/stm32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 21588 bytes

collect2.exe: error: ld returned 1 exit status

Using library SrcWrapper at version 1.0.1 in folder: C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\libraries\SrcWrapper

exit status 1

Error compiling for board Generic STM32F0 series.

but when i select stm32f1 .i was ok.
but with stm32f1 in b4r i got this error.
B4X:
B4R Version: 3.31
Parsing code.    (0.00s)
Building folders structure.    (0.03s)
Compiling code.    (0.01s)
Building project    (0.05s)
Compiling & deploying Ino project (Generic STM32F1 series - COM6)    Error
Loading configuration...
Initiuserzing packages...
Preparing boards...
Verifying...
2020-08-03T16:03:05.064Z INFO c.a.u.n.HttpConnectionManager:153 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Connect to https://builder.arduino.cc/builder/v1/boards/0x10C4/0xEA60, method=GET, request id=2216D2BAF2CB4EC7
2020-08-03T16:03:06.613Z INFO c.a.u.n.HttpConnectionManager:157 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Request complete URL="https://builder.arduino.cc/builder/v1/boards/0x10C4/0xEA60", method=GET, response code=404, request id=2216D2BAF2CB4EC7, headers={null=[HTTP/1.1 404 Not Found], Cache-Control=[no-cache, no-store, must-revuserdate], Server=[nginx], Connection=[keep-userve], Vary=[Origin], Pragma=[no-cache], Expires=[0], Content-Length=[0], Date=[Mon, 03 Aug 2020 16:03:06 GMT]}
2020-08-03T16:03:06.615Z WARN p.a.h.BoardCloudResolver:64 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Fail to get the Vid Pid information from the builder response code=404
Uploading...
An error occurred while uploading the sketch
STM32_Programmer_CLI.exe not found.
Please install it or add <STM32CubeProgrammer path>\bin' to your PATH environment:
https://www.st.com/en/development-tools/stm32cubeprog.html
Aborting!
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Please install it or add <STM32CubeProgrammer path>\bin' to your PATH environment:
Based on this message, you can probably solve it by finding the folder and adding it to the PATH environment.
My guess is that it will be somewhere under:
C:\Users\user\AppData\Local\Arduino15\packages\STM32

As you see, this board is not supported by B4R and will require some work to get it running.
 
Upvote 0

mzelecom

Member
i install STM32CubeProgrammer and now compile ok.
how about commenting ( // ) print(Double&, byte&) in in B4RCore.cpp .how to fix it
 
Upvote 0
Top