WeAct STM32F411CEU6 black pill

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
CATSUPERBERG
Posts: 5
Joined: Mon Jan 11, 2021 12:47 pm

Re: WeAct STM32F411CEU6 black pill

Post by CATSUPERBERG » Wed Jan 13, 2021 6:20 am

rcolistete wrote:
Wed Jan 13, 2021 4:01 am
Yes, it is supported. Example :
Thanks for the answer with example, i guess the port for my F401CC (256 kb) doesn't support it, gonna wait for my F411CE boards.

bartag
Posts: 4
Joined: Sat Jan 16, 2021 9:33 pm

Re: WeAct STM32F411CEU6 black pill

Post by bartag » Sat Jan 16, 2021 10:02 pm

Hi,

I'm quite new to MP and STM32, so please forgive me if my question is too trivial!

Is there a way to extend the allowed maximum firmware size during compile when I use W25Q128?
I figured out that I need to search around FLASH_TEXT and FLASH_FS... but I'm stuck here.

My reason:
I try to compile a FW with WIZNET5K and LWIP support and I try to freeze the MicroWebSrv2 module into it.

Code: Select all

make MICROPY_PY_WIZNET5K=5500 MICROPY_PY_LWIP=1 BOARD=WEACT_F411CEU6 -j2
Without the MicroWebSrv2 it compiles fine, but as soon as I try to integrate it, I got the following error:

Code: Select all

LINK build-WEACT_F411CEU6/firmware.elf
arm-none-eabi-ld: build-WEACT_F411CEU6/firmware.elf section `.text' will not fit in region `FLASH_TEXT'
arm-none-eabi-ld: region `FLASH_TEXT' overflowed by 30536 bytes
make: *** [Makefile:669: build-WEACT_F411CEU6/firmware.elf] Error 1

bogdansrb
Posts: 3
Joined: Fri Jan 22, 2021 6:35 pm

Re: WeAct STM32F411CEU6 black pill

Post by bogdansrb » Fri Jan 22, 2021 6:43 pm

Hello everyone! I have this "black pill" f401ccu6 board. I bought it a long time ago and haven't used it, but I now need a board on which to put mycropython. On the back of the board it says "weact v2.0". I wasn't able to find an image for it, the official github page has documentation and images for f401ceu6. Any way to get micropython running on this?

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: WeAct STM32F411CEU6 black pill

Post by SpotlightKid » Fri Jan 22, 2021 7:47 pm

This is apparently an update of this variant of the Black Pill:

https://stm32-base.org/boards/STM32F401 ... -Pill-V1.2

You need to compile your own firmware for this variant of the Black Pill.

You should be able to use this board definition from WeACT:

https://github.com/YXZhu/micropython/tr ... Act_F401CC

You can follow the instructions for mcausers board definition for the STM32F411CEU6:

https://github.com/mcauser/WEACT_F411CEU6

And adapt them where necessary.

Hth, Chris

bogdansrb
Posts: 3
Joined: Fri Jan 22, 2021 6:35 pm

Re: WeAct STM32F411CEU6 black pill

Post by bogdansrb » Mon Jan 25, 2021 7:49 am

Ok so I tried doing just that, got the board definitions and tried building but I get a bunch of errors and compilation stops:

Code: Select all

In file included from ./mpconfigport.h:31,
                 from ../../py/mpconfig.h:62,
                 from ../../lib/oofatfs/ffconf.h:30,
                 from ../../lib/oofatfs/ff.h:33,
                 from ../../lib/oofatfs/ff.c:28:
boards/WeAct_F401CC/mpconfigboard.h:19: error: "MICROPY_VFS_FAT" redefined [-Werror]
   19 | #define MICROPY_VFS_FAT             (0)
      | 
<command-line>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
In file included from ./mpconfigport.h:31,
                 from ../../py/mpconfig.h:62,
                 from ../../lib/oofatfs/ffconf.h:30,
                 from ../../lib/oofatfs/ff.h:33,
                 from ../../lib/oofatfs/ffunicode.c:26:
boards/WeAct_F401CC/mpconfigboard.h:19: error: "MICROPY_VFS_FAT" redefined [-Werror]
   19 | #define MICROPY_VFS_FAT             (0)
      | 
and so on...

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WeAct STM32F411CEU6 black pill

Post by davef » Tue Jan 26, 2021 2:00 am

Hi bartag,

Did you modify your mpconfigboard.h file?

I tried your line:

Code: Select all

make MICROPY_PY_LWIP=1 BOARD=WEACT_F411CEU6 -j2
without WIZNET and it compiled for me using arm-none-eabi-gcc-4.9.3 on a 32 bit machine. Thanks for the hint ... I have been messing around in the mpconfigboard files ... this looks an easier way to do it.

I would like to build in support for PPP as well so I can try to talk to a Huawei 3G dongle. Any suggestions?

Thanks,
Dave

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WeAct STM32F411CEU6 black pill

Post by davef » Tue Jan 26, 2021 10:15 am

bartag,

I tried building with the W25Q32 by changing line 9 in mpconfigboard.h and got the same problem. I think there are some hints earlier in this thread so I am off to re-read them.

Tried the other fork here:

Code: Select all

git clone https://github.com/jugnu-jethi/WeAct_F411CE-MicroPython.git WeAct_F411CE
and got the same error. I noticed that the lines:

Code: Select all

#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
#define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1)
were not in his mpconfigboard.h file. Even including them made no difference.
Off to find who generates the FLASH_TEXT message.

Both firmware.map and stm32f411.ld have the name FLASH_TEXT in them, the first length 0x00060000 (393,216) and the second 384K.

Doesn't something need to change these numbers when you use bigger flash?

bartag
Posts: 4
Joined: Sat Jan 16, 2021 9:33 pm

Re: WeAct STM32F411CEU6 black pill

Post by bartag » Sun Feb 07, 2021 3:02 pm

@davef

I don't know if this is the proper solution, but this worked for me:

In STM32F411.ld I changed from this:

Code: Select all

/* Specify the memory areas */
MEMORY
{
    FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */
    FLASH_ISR (rx)  : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
    FLASH_FS (rx)   : ORIGIN = 0x08004000, LENGTH = 112K /* sectors 1,2,3 are 16K, 4 is 64K */
    FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 384K /* sectors 5,6,7 are 128K */
    RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 128K
}
To this:

Code: Select all

/* Specify the memory areas */
MEMORY
{
    FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */
    FLASH_ISR (rx)  : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
    FLASH_FS (rx)   : ORIGIN = 0x08004000, LENGTH = 16K /*  */
    FLASH_TEXT (rx) : ORIGIN = 0x08008000, LENGTH = 480K /*  */
    RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 128K
}
Whit this the compiler does not drop an error about the firmware size.
Unfortunatelly the

Code: Select all

dfu-util --alt 0 -D <path to .dfu>
does not work anymore, because it tries to flash the two chunks into the original addresses (0x08000000 and 0x08020000, instead of 0x08000000 and 0x08008000)
I was able to write the firmware with the following two commands:

Code: Select all

dfu-util -s 0x08000000:leave -a 0 -D firmware0.bin
dfu-util -s 0x08008000:leave -a 0 -D firmware1.bin
!!TODO: It would be nice to get rid of that remaining 16K FLASH_FS part (external SPI flash is used, that 16K is not in use), and add that area to the FLASH_TEXT.

So at the end, it compiled, it could be flashed... but the RAM is not enough to load .pyhtml files to the MicroWebSrv2... but this is just my problem, the basic task (enlarge the size of the FLASH_TEXT) is done :)

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WeAct STM32F411CEU6 black pill

Post by davef » Sun Feb 07, 2021 6:52 pm

@bartag,

You have exceeded my rather limited knowledge-base.

Good luck, hope someone else can help!

CATSUPERBERG
Posts: 5
Joined: Mon Jan 11, 2021 12:47 pm

Re: WeAct STM32F411CEU6 black pill

Post by CATSUPERBERG » Sat Feb 20, 2021 9:05 pm

When I build firmware using files from "jugnu-jethi/WeAct_F411CE-MicroPython" or modified mcauser files (to fix building errors) everything seems to work fine. But reset to factory settings feature doesn't work. It seems it activates but can't do what it supposed to do. I press the "key" button, than reset the board, wait for LED to flash 3 times, than release "key", LED lights up for a couple of seconds like it writes to the flash, but all the files are still there, it doesn't go to default empty boot.py and main.py.
Is there a way to bring it back to working order? It works with firmwares from WeAct github.

Also, with latest source build fails with this error: error: implicit declaration of function 'LL_USART_SetBaudRate'. I think i solved it by adding "#include "stm32f4xx_ll_usart.h"" to stm32f4xx_hal_conf.h (after #ifdef HAL_UART_MODULE_ENABLED).

Post Reply