STM32F3 ports

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.
User avatar
dhylands
Posts: 3025
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: STM32F3 ports

Post by dhylands » Sun Feb 10, 2019 9:40 pm

Which cache are you referring to?

It looks like the flash memory on the STM32F303xC is arranged as 128 pages of 2Kbytes each. On the F4 it has much larger flash blocks, so the 64K CCM memory winds up getting used for the filesystem. On the F303 it looks like there is 40K of SRAM and 8K of CCM SRAM.

The heap/stack should go in the 40K SRAM, and I'd probably wind up using the 8K CCM SRAM for the file system. I'm not sure if this is what you mean by cache? Some of the processors like the F7/H7 have real data/instruction caches.

romeo
Posts: 21
Joined: Mon Jan 28, 2019 5:57 pm

Re: STM32F3 ports

Post by romeo » Sun Feb 10, 2019 9:52 pm

dhylands wrote:Which cache are you referring to?

It looks like the flash memory on the STM32F303xC is arranged as 128 pages of 2Kbytes each. On the F4 it has much larger flash blocks, so the 64K CCM memory winds up getting used for the filesystem. On the F303 it looks like there is 40K of SRAM and 8K of CCM SRAM.

The heap/stack should go in the 40K SRAM, and I'd probably wind up using the 8K CCM SRAM for the file system. I'm not sure if this is what you mean by cache? Some of the processors like the F7/H7 have real data/instruction caches.
In flashbdev.c is the remaining problem!

Trimis de pe al meu SM-N9005 folosind Tapatalk


User avatar
dhylands
Posts: 3025
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: STM32F3 ports

Post by dhylands » Sun Feb 10, 2019 10:05 pm

I'd use the 8K CCM SRAM for the flash cache.

romeo
Posts: 21
Joined: Mon Jan 28, 2019 5:57 pm

Re: STM32F3 ports

Post by romeo » Sun Feb 10, 2019 10:09 pm

dhylands wrote:I'd use the 8K CCM SRAM for the flash cache.
Ok. I'll give a try tomorrow. If succeeded, I'll let you know!

romeo
Posts: 21
Joined: Mon Jan 28, 2019 5:57 pm

Re: STM32F3 ports

Post by romeo » Mon Feb 11, 2019 7:10 pm

Solved one!
Got another error!
20190211_01.PNG
20190211_01.PNG (16.58 KiB) Viewed 113 times
Thanks,
Romeo

User avatar
dhylands
Posts: 3025
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: STM32F3 ports

Post by dhylands » Mon Feb 11, 2019 8:57 pm

It looks like you need to add the following line to ports/stm32/Makefile:

Code: Select all

CFLAGS_MCU_f3 = $(CFLAGS_CORTEX_M) -mtune=cortex-m3 -mcpu=cortex-m3
in this block: https://github.com/micropython/micropyt ... kefile#L71

Make sure you do a clean, because all of the objects will have been built for the wrong MCU.

Then you'll run into a few more issues in stm32_it.c that aren't as straight forward.

For the first error, I think that you just need to add __IO to the extern declaraion of uwTick.

For the issues that I see you'll need to see what the macros do on the F4 and then see if there is equivalent functionality on the F3 by comparing datasheets. It's possible that you'll need to add some #if's or something.

For the CAN stuff I suspect that the CAN peripheral is slightly different between the F3 and F4 and so will most likely require some #ifs

For any changes you make to stm32_it.c you'll want to try build for some other boards to make sure that they continue to work.

romeo
Posts: 21
Joined: Mon Jan 28, 2019 5:57 pm

Re: STM32F3 ports

Post by romeo » Tue Feb 12, 2019 8:46 pm

Hi,
I made one step forward, but still in error!
Can't figure out what should be in here!
I've tried to compare with files on st.com ... but it doesn't seem to work!
Any ideas?

Thanks,
Romeo
20190212_01.PNG
20190212_01.PNG (31.71 KiB) Viewed 86 times

User avatar
dhylands
Posts: 3025
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: STM32F3 ports

Post by dhylands » Tue Feb 12, 2019 10:16 pm

The F3 doesn't have a PHY control, so I'd put

Code: Select all

#if defined(__HAL_PCD_UNGATE_PHYCLOCK) // Not available on the F3
around that line.

For the others, I disabled USB and CAN and then it gets further. The USB peripheral on the F3 looks to be totally different from the F4, so I suspect that quite a few changes will be required to support that.

romeo
Posts: 21
Joined: Mon Jan 28, 2019 5:57 pm

Re: STM32F3 ports

Post by romeo » Wed Feb 13, 2019 7:27 pm

Ok. Tried that. Still the errors appears!
20190213.PNG
20190213.PNG (19.93 KiB) Viewed 75 times
Thanks,
Romeo

User avatar
dhylands
Posts: 3025
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: STM32F3 ports

Post by dhylands » Wed Feb 13, 2019 10:39 pm

The PLL portion seems to be different between the F3 and the F4, so you'll need to change things to work with the F3.

Post Reply