Page 4 of 5

Re: STM32F3 ports

Posted: Sun Feb 10, 2019 9:40 pm
by dhylands
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.

Re: STM32F3 ports

Posted: Sun Feb 10, 2019 9:52 pm
by romeo
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


Re: STM32F3 ports

Posted: Sun Feb 10, 2019 10:05 pm
by dhylands
I'd use the 8K CCM SRAM for the flash cache.

Re: STM32F3 ports

Posted: Sun Feb 10, 2019 10:09 pm
by romeo
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!

Re: STM32F3 ports

Posted: Mon Feb 11, 2019 7:10 pm
by romeo
Solved one!
Got another error!
20190211_01.PNG
20190211_01.PNG (16.58 KiB) Viewed 7182 times
Thanks,
Romeo

Re: STM32F3 ports

Posted: Mon Feb 11, 2019 8:57 pm
by dhylands
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.

Re: STM32F3 ports

Posted: Tue Feb 12, 2019 8:46 pm
by romeo
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 7155 times

Re: STM32F3 ports

Posted: Tue Feb 12, 2019 10:16 pm
by dhylands
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.

Re: STM32F3 ports

Posted: Wed Feb 13, 2019 7:27 pm
by romeo
Ok. Tried that. Still the errors appears!
20190213.PNG
20190213.PNG (19.93 KiB) Viewed 7144 times
Thanks,
Romeo

Re: STM32F3 ports

Posted: Wed Feb 13, 2019 10:39 pm
by dhylands
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.