Is there a howto for utlizing reference firmware examples?
crosswick opened this issue · 7 comments
Hi again - this time I'd like to try out an I2S example project for the GD32E103, and I thought I'd try to use the factory firmware examples first. A bit of a primer on how to make a PlatformIO project out of that would be very welcome.
Ah in the mean time I've found these two to study:
and
Sorry, I'll add a proper tutorial for this in the README.
The TL;DR is, if your project doesn't need any complicated libraries (like the USB stack or whatever), you create a new SPL project for your target chip, that gives you the base folder structure and platformio.ini
. Now copy all files from the example (like this one) into the src/
folder of the PlatformIO project, but don't copy the x_libopt.h
file, since this is included in our SPL package. Then it should compile right away with no further configuration.
Alright, thank you - and when you say "create a new SPL project for your target chip", do you mean starting with this project for example?
https://github.com/CommunityGD32Cores/gd32-pio-projects/tree/main/gd32-spl-blinky
That can be used as a starting project but its platformio.ini
is filled with a lot of boards, if you just have one target board you'd have to delete all the [env:...]
and create a new env with the board you have. What I meant is that you can create one in the regular PlatformIO new project wizard though. In the board searchbox you can start typing your chip name (GD32...) and select "SPL" as framework, give the project a name and click finish.
Thanks, that worked - although I did need to change the GPIO pin in gd32e10x_eval.h because I am using a different board.
Also for some reason in the E103 I2S example the LED behavior seems inverted from the description, but that's beyond the scope of this issue, and it could be I'm simply overlooking something.
If the GD32-E103 board has an inverted-LED logic, i.e., drive pin LOW to make LED light up, and your board has a regular-logic with drive HIGH -> light (or vice-versa), the app will have the inverted behavior, so that is well possible.
Right - I just verified that is indeed the case by commenting out the existing LED logic; using
gd_eval_led_off(LED2);
turns the LED on.