Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platformio INI settings help - program runs when flashed from Arduino but not PlatformIO #41

Open
MATT-ER-HORN opened this issue Dec 15, 2022 · 0 comments

Comments

@MATT-ER-HORN
Copy link

MATT-ER-HORN commented Dec 15, 2022

After a bit work I was able to get a generic "blink.ino" sketch uploaded and running when using the Arudino IDE and the settings found here: https://onstep.groups.io/g/main/message/43912 and changing the upload address to 0x08010000 in the "stm32CubeProg.sh" script. ( 0x08008000 doesn't work even when I use the newer bootloader, not sure why)

However when I upload the same code using platformio the program doesn't run after uploading. Here is my current is .ini file for platformio:

[env:fysetc_s6]
platform = ststm32
board = fysetc_s6
framework = arduino
upload_protocol = dfu
board_upload.offset_address = 0x8010000
build_flags = -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC -Os

Does anyone have any tips to get the DFU upload working in plaformio for the S6? I assume I could use the same .ini which is used for the marlin build but I can't seem to figure out all the settings since many of the settings are found in separate scripts called by the ini file.

The output from the terminal during the upload:

CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/fysetc_s6.html
HARDWARE: STM32F446VET6 168MHz, 128KB RAM, 512KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:

  • framework-arduinoststm32 @ 4.20200.221104 (2.2.0)
  • framework-cmsis @ 2.50700.210515 (5.7.0)
  • tool-dfuutil @ 1.11.0
  • tool-openocd @ 2.1100.211028 (11.0)
  • tool-stm32duino @ 1.0.2
  • toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 11 compatible libraries
    Scanning dependencies...
    No dependencies
    Building in release mode
    MethodWrapper(["checkprogsize"], [".pio\build\fysetc_s6\firmware.elf"])
    Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
    RAM: [ ] 3.2% (used 4184 bytes from 131072 bytes)
    Flash: [ ] 5.0% (used 26164 bytes from 524288 bytes)
    .pio\build\fysetc_s6\firmware.elf :

section size addr

.isr_vector 452 134217728

.text 23744 134218180

.rodata 1880 134241924

.ARM.extab 0 134243804

.ARM 8 134243804

.preinit_array 0 134243812

.init_array 20 134243812

.fini_array 8 134243832

.data 540 536870912

.bss 3644 536871452

.noinit 0 536875096

._user_heap_stack 1536 536875096

.ARM.attributes 48 0

.comment 102 0

.debug_frame 1360 0

Total 33342
(["upload"], [".pio\build\fysetc_s6\firmware.bin"])
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, serial, stlink
CURRENT: upload_protocol = dfu
"C:\Users\User.platformio\packages\tool-dfuutil\bin\dfu-util" -d 0x0483:0xDF11 -a 0 -s 0x8010000:leave -D "D:\onedrive\OneDrive - UBC\Documents\PlatformIO\Projects\s6_test_3.pio\build\fysetc_s6\firmware.bin"
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
Device ID 0483:df11
Device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(10) = dfuERROR, status(10) = Device's firmware is corrupt. It cannot return to run-time (non-DFU) operations
Clearing status
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
Downloading element to address = 0x08010000, size = 26652

Erase [ ] 0% 0 bytes
Erase [ ] 0% 0 bytes
Erase [= ] 7% 2048 bytes
Erase [=== ] 15% 4096 bytes
Erase [===== ] 23% 6144 bytes
Erase [======= ] 30% 8192 bytes
Erase [========= ] 38% 10240 bytes
Erase [=========== ] 46% 12288 bytes
Erase [============= ] 53% 14336 bytes
Erase [=============== ] 61% 16384 bytes
Erase [================= ] 69% 18432 bytes
Erase [=================== ] 76% 20480 bytes
Erase [===================== ] 84% 22528 bytes
Erase [======================= ] 92% 24576 bytes
Erase [======================== ] 99% 26624 bytes
Erase [=========================] 100% 26652 bytes
Erase done.

Download [ ] 0% 0 bytes
Download [= ] 7% 2048 bytes
Download [=== ] 15% 4096 bytes
Download [===== ] 23% 6144 bytes
Download [======= ] 30% 8192 bytes
Download [========= ] 38% 10240 bytes
Download [=========== ] 46% 12288 bytes
Download [============= ] 53% 14336 bytes
Download [=============== ] 61% 16384 bytes
Download [================= ] 69% 18432 bytes
Download [=================== ] 76% 20480 bytes
Download [===================== ] 84% 22528 bytes
Download [======================= ] 92% 24576 bytes
Download [======================== ] 99% 26624 bytes
Download [=========================] 100% 26652 bytes
Download done.
File downloaded successfully
Submitting leave request...
Transitioning to dfuMANIFEST state
====================================================================================== [SUCCESS] Took 12.91 seconds ======================================================================================

  • Terminal will be reused by tasks, press any key to close it.

And the blink script I am trying to upload that works using the Arduino IDE
#include <Arduino.h>
/*
Blink
This example code is in the public domain.

https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(PB3, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(PB3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(PB3, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant