STM32F103C8 BluePill VGA Project

What are you developing?
feluga
Posts: 21
Joined: Wed Mar 18, 2020 2:50 am
Answers: 1

STM32F103C8 BluePill VGA Project

Post by feluga »

Hi Guys!

I'm working on a minimalist VGA driver for the Bluepill (STM32F103C8T6) that uses smallest possible portion of RAM and Flash.
It also uses PC13, PC14 and PC15 for colors (8 possible colors) in order to leave most valuable pins free for other use.

Currenty it's in development, but I have reached some project millestones:
- VGA pins used are PC15, PC14 and PC13 for Red, Green and Blue signal
- It also uses PA9 and PB6 for HSync and VSync.
- It produces 8 colors
- Resolution is 224 x 240 pixels
- It works with Tiles and each tile can have only two colors (foreground and background colors)
- Each tile has its own pair of colors.
- it has 28x30 tiles - each tile has 8x8 pixels and it is in flash memory space using 8 bytes / tile
- A tile is ie a character bitmap, but it can be used for anything else.
- It is currently based on Roger's Core that already uses about 2,700 bytes of RAM and 12K of flash just to run a blink.
- At this point a "Hello World" example for VGA uses 4.5K RAM and 18.5 K Flash, including Roger's Core Code.

It's fully Arduino IDE compatible by the way!

Update: A new version is now released. The library BlueVGA 1.0 works transparently for both cores (STM32 and Roger's).
The library and source code can be found in https://github.com/RoCorbera/BlueVGA

Some Screenshots:
scr1.gif
scr1.gif (43.37 KiB) Viewed 660 times
src2.gif
src2.gif (50.84 KiB) Viewed 660 times

As this project moves forward I'll keep you all posted.
Last edited by feluga on Sat May 16, 2020 4:05 am, edited 1 time in total.

stevestrong
Posts: 186
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 5
Location: Munich, Germany
Contact:

Re: STM32F103C8 BluePill VGA Project

Post by stevestrong »

+10
That's cool!
Do you consider sharing your code? Maybe on Github?

User avatar
fpiSTM
Posts: 442
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 15
Location: Le Mans
Contact:

Re: STM32F103C8 BluePill VGA Project

Post by fpiSTM »

WOW nice :shock:

User avatar
Bakisha
Posts: 22
Joined: Fri Dec 20, 2019 6:50 pm
Contact:

Re: STM32F103C8 BluePill VGA Project

Post by Bakisha »

+1
Intresting choise of pins PA9/PB6. Is that without timers for hsync/vsync? And such small memory footprint. Recalculating every (second) line based on chars, not as bitmap. And probably streaming that data with dma to portC?
Can't wait to see the code.

feluga
Posts: 21
Joined: Wed Mar 18, 2020 2:50 am
Answers: 1

Re: STM32F103C8 BluePill VGA Project

Post by feluga »

Bakisha wrote:
Fri Apr 24, 2020 6:18 am
+1
Intresting choise of pins PA9/PB6. Is that without timers for hsync/vsync? And such small memory footprint. Recalculating every (second) line based on chars, not as bitmap. And probably streaming that data with dma to portC?
Can't wait to see the code.
I used a lot of coding resources. In order to achieve such low footprint, I used assembly, C, C++ and direct bare metal programming.
It was not easy...

feluga
Posts: 21
Joined: Wed Mar 18, 2020 2:50 am
Answers: 1

Re: STM32F103C8 BluePill VGA Project

Post by feluga »

stevestrong wrote:
Thu Apr 23, 2020 7:42 pm
+10
That's cool!
Do you consider sharing your code? Maybe on Github?
I'm considering it... It's still a WIP.
I'll work on an Arduino Library Version and share it on GitHub and Arduino environments.

mrburnette
Posts: 121
Joined: Thu Dec 19, 2019 1:23 am

Re: STM32F103C8 BluePill VGA Project

Post by mrburnette »

feluga wrote:
Thu Apr 23, 2020 7:27 pm
...
- It is currently based on Roger's Core that already uses about 2,700 bytes of RAM and 12K of flash just to run a blink.
- At this point a "Hello World" example for VGA uses 4.5K RAM and 18.5 K Flash, including Roger's Core Code.

It's fully Arduino IDE compatible by the way!
...
It has been years since I poked around in the re-born LeafLabs core known as Roger's core. But I seem to recall opportunities for reducing the binary size at the expense of Arduino syntax compatibility.

+1
Nice effort.

feluga
Posts: 21
Joined: Wed Mar 18, 2020 2:50 am
Answers: 1

Re: STM32F103C8 BluePill VGA Project

Post by feluga »

mrburnette wrote:
Fri Apr 24, 2020 5:29 pm
It has been years since I poked around in the re-born LeafLabs core known as Roger's core.
LeafLabs / Roger's Core is an excellent Arduino framework. It's worthy continue using because it works seamsly and it is an exceptional tool for beginners.

mrburnette wrote:
Fri Apr 24, 2020 5:29 pm
But I seem to recall opportunities for reducing the binary size at the expense of Arduino syntax compatibility.
I used some internal C functions from LeafLabs Arduino framework, as well as some bare metal register manipulation. Combining that to some ASM code I managed to reduce the final footprint of the library I'll publish. It was a great opportunity to dive deeply into this framework and understand some of its internal details. I think it was worth it.

There is a significant detail for me.... arm-gcc version from Arduino Due, used in Roger's core. It sound like it can create a smaller and more efficient machine code. I tried using STM32 Core but I could not reach neither size nor performance... Not sure why, but I didn't dive on this other core yet. Maybe some of the options used with gcc.

Maybe someone else has come better information on the difference of way both do compile and link.

mrburnette
Posts: 121
Joined: Thu Dec 19, 2019 1:23 am

Re: STM32F103C8 BluePill VGA Project

Post by mrburnette »

feluga wrote:
Fri Apr 24, 2020 7:21 pm
...
There is a significant detail for me.... arm-gcc version from Arduino Due, used in Roger's core. It sound like it can create a smaller and more efficient machine code. I tried using STM32 Core but I could not reach neither size nor performance... Not sure why, but I didn't dive on this other core yet. Maybe some of the options used with gcc.

Maybe someone else has come better information on the difference of way both do compile and link.
I do not know enough about your current work or long-term intentions to offer much advice, but compiler switches for gcc, as well linking methodologies often affect bin size. Additionally, the standard C library is not used with either STM32duino implementation; rather RedHat's newlib is used. My experience with newlib has generally been favorable. You may find this link of interest, too.

I will leave you with this one suggestion: read the Arduino.cc documentation for creating your binary using make.

feluga
Posts: 21
Joined: Wed Mar 18, 2020 2:50 am
Answers: 1

Re: STM32F103C8 BluePill VGA Project

Post by feluga »

I'm looking for some advice..... thinking about this arduino library for VGA.

Should I focus on Roger's Core or should I move directly to STM32 Core?
What is your view on that?

Is Roger's Core sort of dead?

Thanks in advance!

Post Reply

Return to “Projects”