chettrick / discobsd

2.11BSD-based Unix-like OS for STM32 and PIC32 Microcontrollers
http://www.DiscoBSD.org
BSD 3-Clause "New" or "Revised" License
181 stars 16 forks source link

Support inexpensive WeAct Studio STM32F4 Core boards #15

Open extrowerk opened 8 months ago

extrowerk commented 8 months ago

There is a new (?) cheap board family available via aliexpress, which could be a nice candidate for porting.

It is sold under the name "WeAct STM32F405RGT6 STM32F412RET6 STM32F446RET6 STM32F405 STM32F412 STM32F446 STM32F4 STM32 Core Board Demo Board Micropython" and it is sold under US$5.

Please consider to port DiscoBSD to this board.

Specs:

STM32F412RET6

STM32 Dynamic Efficiency MCU with BAM, High-performance and DSP with FPU, Arm Cortex-M4 MCU with 512 Kbytes of Flash memory, 100 MHz CPU, Art Accelerator, DFSDM

STM32F446RET6

High-performance foundation line, Arm Cortex-M4 core with DSP and FPU, 512 Kbytes of Flash memory, 180 MHz CPU, ART Accelerator, Dual QSPI

STM32F405RGT6

High-performance foundation line, Arm Cortex-M4 core with DSP and FPU, 1 Mbyte of Flash memory, 168 MHz CPU, ART Accelerator

DataLink

https://github.com/WeActStudio/WeActStudio.STM32F4_64Pin_CoreBoard.git


There are other alternative boards from the same company, the "WeAct STM32H723VGT6 STM32H723 STM32H7 STM32 Core Board Demo Board" looks pretty nice aswell

extrowerk commented 8 months ago

Or the "WeAct STM32H7 STM32H743 STM32H743VIT6 STM32 Board 2M Flash 1M RAM Learning Board Development board"

chettrick commented 8 months ago

@extrowerk Those boards look interesting. I wonder how they can be priced below the unit price for an STM32F4 part. Perhaps the chips are clones? Even if they are clones, and they are largely similar to the regular STM32F4, then I don't see much issue in supporting these boards. I do not yet have any of these boards but I will look into getting some soon. Thanks for the pointer.

Also, patches are appreciated, if you get to porting to them before I do.

extrowerk commented 8 months ago

Sadly i am not up for the task, but let us know which model you pick, so we can do beta-tests :)

chettrick commented 8 months ago

I ordered each of the boards with STM32F412, STM32F446, and STM32F405 chips, but it will take a while before they are shipped to me.

DiscoBSD already supports the F412 and F407, so the WeAct boards with those chips will be easy to port. I will port the NUCLEO-F446RE board before starting on the WeAct F446 board.

A bit of work is required to support the STM32F7 and H7 chips (Cortex-M7), so I'll currently be skipping boards with those chips in the near future.

Also, I have done a bit of work in supporting Cortex-M0+, which will be good for the obvious target of the Raspberry Pi Pico RP2040. More work still needs to be done, though.

chettrick commented 7 months ago

I received my boards from AliExpress recently. I just added initial support for the WeAct Studio STM32F412RET6 Core board in commit a2bd2a0. The commit message has a lot of the details, but it seems to work quite well actually.

Thanks for the tip!

chettrick commented 7 months ago

Commit 3488639 enables the building and cleaning of the sys/stm32/f412weactcore kernel compile directory.

extrowerk commented 7 months ago

Nice! Which other models do you plan to support if any?

chettrick commented 7 months ago

I will support the WeAct F405 board next, and the WeAct F446 board once the F446 Nucleo board is supported. I also have other ST F4 dev boards, and also a few ST L4 boards.

Which boards do you have?

Before supporting the L4, or even the RP2040 or other Cortex-M4 chips from other suppliers, a better organization of the BSP and HAL bits from each vendor is needed. It probably will end up looking similar to how NetBSD and OpenBSD deal with different architectures and the specific vendor drivers for those. The #ifdefs are already too much.

extrowerk commented 7 months ago

I have currently only an OX64, an Rpi Pico and similar unsupported boards. I am interested in the smallest viable system for a unixy handheld with a VT100-like display and a keyboard. Possibly with some kind of networking and USB support, ideally.

chettrick commented 7 months ago

I have just added initial support for the WeAct Studio STM32F412RET6 Core board in commit 493325861c47960aa73d45c5c721dd5ae438f591. Review the commit message for all the specific details.

These boards are pretty good, especially their small size. Major downsides are that they don't include an onboard debugger chip like an ST-Link nor a virtual com port. A USB to serial FTDI cable with female pins can be used to connect to the debug header for the standard console access to DiscoBSD. That works pretty good. An just use a spare Nucleo board for its ST-Link for debugging.

A USB uart would be nice to have, but the STM32Cube USB driver software in the HAL has a separate license that is not appropriate for inclusion in this operating system. Any pointers to better licensed USB uart for STM32 would be great.

chettrick commented 7 months ago

I have currently only an OX64, an Rpi Pico and similar unsupported boards. I am interested in the smallest viable system for a unixy handheld with a VT100-like display and a keyboard. Possibly with some kind of networking and USB support, ideally.

Have you looked at the Beepy yet? I would like to get DiscoBSD running on that form factor.

extrowerk commented 7 months ago

Hi, thanks for the hint, i know about Beepy, but it is not available at tihs moment sadly :( I also like the BlackBerry-liek form-factor...

extrowerk commented 7 months ago

I am happy to see your nice progress! The community now have access to cheap, small and available boards to test BSD on them. :)

chettrick commented 6 months ago

Yes it is a shame about the lack of availability for a Beepy.

Thank you for the kind words! I started this whole project to create something I wanted to exist in the world, and no one had done it yet. I searched and searched for any actual progress and found none. The closest I found was this post on the old RetroBSD forum (before it was shut down) for people wanting to have RetroBSD on Arm, but no one rose to the challenge and made it happen. So I did.

For a long while now, I have completed all the required porting tasks outlined by Serge for a port of RetroBSD to another architecture. Only one item remains, and that is using the memory protection unit to guard kernel data. I will be working on that once I finish setting up a continuous integration build server for automatically doing full snapshots and releases.

chettrick commented 6 months ago

This is the list I wrote down from Serge V's post in that forum thread:

List of items to be done for ARM port, from Serge V:
- Most of kernel is arch-independent (sys/kernel,
  sys/include) ==> There is a small number of places where a
  saved stack frame is directly referenced (look for
  u.u_frame), it needs #ifdef guards.
- Make sys/stm32 like sys/pic32.
- Use sys/pic32/baremetal/Makefile config as starting point.
- Make copies of arch-dependent files from sys/pic32 to
  sys/stm32 and modify them:
  cpu.h, io.h, limits.h, machparam.h, startup.S, clock.c,
  cons.c, devsw.c, exception.c, machdep.c, mem.c, signal.c,
  sysctl.c.
- Design memory map and linker script
- Design user/kernel API: how to pass args to syscalls and
  get returned data. ==> Build syscall library at
  src/libc/thumb2/sys (maybe arm instead of thumb2).
- Port assembler files from NetBSD or OpenBSD.
- MPU used to protect kernel data region from user programs.

Of course there are a lot more areas that need to be addressed (for example, signal handling), but it was a good starting point.

chettrick commented 6 months ago

The community now have access to cheap, small and available boards to test BSD on them. :)

Even on Windows it is very easy to run a recent version of DiscoBSD.

Olimex PIC32-RETROBSD board for running DiscoBSD/pic32:

WeAct STM32F4 board for running DiscoBSD/stm32:

Can't get cheaper and easier than that.

extrowerk commented 6 months ago

@chettrick HAve you seen this "STM32H743IIT6 core development board" board? https://www.aliexpress.com/item/1005006624695409.html It is probably extremely overkill for BSD2.11, but it seems really nice as far as i see.

chettrick commented 6 months ago

That is quite the beast of a processor! 1M of ram. It would be helpful to have loads of ram in the future for running compilers. That chip is a Cortex-M7 part, so it is a bit different than the Cortex-M4 that is currently targeted by DiscoBSD. It wouldn't be a ton of work to do the port though.

extrowerk commented 5 months ago

We have also this: https://www.aliexpress.com/item/1005002953507348.html and this: https://www.aliexpress.com/item/1005004632489443.html