platformio / platform-ststm8

ST STM8: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/ststm8
Apache License 2.0
40 stars 26 forks source link

Add native-blink example #46

Closed maxgerhardt closed 3 years ago

maxgerhardt commented 3 years ago

Adds a native blink example using only one C file and the device header file for comfort from https://github.com/gicking/STM8_headers from @gicking. Analogue to https://github.com/platformio/platform-atmelavr/tree/develop/examples/native-blink.

The STM8_header's MIT license is FOSS and a copy of the license is included per license requirements as the LICENSE_STM8_HEADERS file.

Also, a small project description is added in the README file.

This project is debuggable in all cases and doesn't trigger any of the two SDCC bugs currently plaguing SPL and Arduino.

valeros commented 3 years ago

Looks great! I'm wondering though whether it makes sense to wrap the https://github.com/gicking/STM8_headers repo into a header-only library, so we won't need to sync that native example each time when the headers update.

maxgerhardt commented 3 years ago

I've actually done so at https://github.com/gicking/STM8_headers/pull/5 to make the repo a PlatformIO compatible library, but it hasn't been merged yet. My original repo https://github.com/maxgerhardt/stm8-headers-pio had a copy of that library (with the library.json) in it.

If it gets merged we should be able to just point at

lib_deps = 
   https://github.com/gicking/STM8_headers.git

(or at its name in the library repository if it gets uploaded)

For just "getting it to work" I copy-pasted the three files for the three specified environments in here and copied the license file.

gicking commented 3 years ago

hi, I just merged the PR gicking/STM8_headers#5. Sorry for the delay!

valeros commented 3 years ago

Hi @maxgerhardt ! Any chance you could refactor this example to use STM8_headers as a library?

maxgerhardt commented 3 years ago

I've rebased the example to use

lib_deps =
   https://github.com/gicking/STM8_headers/archive/refs/heads/master.zip

and without the local copy of the files. Sadly there's no tag / stable release I can reference (without assuming all people have a git client installed), and no safe backup copy is in the PIO library registry. Is this okay or should we do it another way?

valeros commented 3 years ago

Thanks again for the PR! I think it's good enough to pull a zip from the master branch so as you mentioned it will work for users without Git installed.

gicking commented 3 years ago

just created a tag v1.0 of the FOSS STM8_headers, see https://github.com/gicking/STM8_headers/releases/tag/v1.0