-
• #2
Hi,
Espruino works off a fixed size memory area, and the default build just uses what's in the bare chip.
You'd have to make your own build that enabled PSRAM/ext flash/etc, and then yes, you could relocate vars into that (assuming it was memory mapped?).
Writing to external flash might be more of an issue, I think you may have to implement that yourself in jshardware.c if the standard STM32 flash write functions won't do it.
... but it's definitely possible to do, just not with a plain build
-
• #3
Hi. Thanks for the quick response, @Gordon!
Sorry for the unclear question, as I was too hasty and misinterpret what we actually want.
For our educational platform project we're planning to build our own board based on STM32F405 or STM32F407 chip (most likely 407). If I understand correctly, Espruino does support these chips.
For our memory problem we're going to use QSPI PSRAM, which Esproino in general can support, according to STM32L496G Discovery Board and its supperior number of vars.
So, can a firmware version for STM32F407 work with a custom board with this chip and can QSPI PSRAM be accessed?Thanks again and sorry for inconvenience of my first post.
3 Attachments
-
• #4
QSPI PSRAM, which Esproino in general can support, according to STM32L496G Discovery Board and its supperior number of vars.
not sure what you mean by this but here
https://github.com/espruino/Espruino/blob/master/boards/STM32L496GDISCOVERY.py#L26
the number of variables (19200) is derived from the amount of SRAM in the chip (320K), no PSRAM usedIf the chip can map PSRAM in hardware into the address space just as ordinary RAM then yes it can be used, however the support for PSRAM for STM32 is not there in Espruino. I think PSRAM somehow works only for ESP32 platform because the SDK does it for you automatically.
EDIT:
Anyway, can you describe what data you plan to keep in PSRAM? Keeping all javascript variables in PSRAM will make everything slower because PSRAM is slow so maybe this is not good solution. Also maybe there will be issues with accessing such memory from interrupts. So maybe using PSRAM as some sort of storage with files or blocks and keeping javascript variables limited to internal SRAM would make better sense. -
• #5
And BTW before trying to add PSRAM to STM32 Espruino make sure it even works properly on the chip you plan to use, I've heard bad words about PSRAM on STM32 see e.g. https://dmitry.gr/?r=06.%20Thoughts&proj=11.%20RP2350 4th paragraph "The problem is that properly supporting QSPI PSRAM is hard. ..." - it is for STM32H7 family but it could be similar, so make sure you understand it may not be easy and check errata and look around if someone has it working properly. For ESP32 it took them several hardware revisions of the chip to have it working correctly with PSRAM and initially you have to use their own version of gcc compiler and libraries with specific workarounds for PSRAM so it would not crash in random places. See https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/external-ram.html#chip-revisions for inspiration what can go wrong
-
• #6
Hi !
I join the question! I am also very interested in the possibility of using external SRAM/SRAM memory on STM32 controllers of the F405,427,429 series, running Espruino.
I think @MarkBloom is mistaken about the possibility to apply QSPI memory on the F405 F407 series, as far as I know there is only the possibility to apply parallel PSRAM/SRAM memory. I am also very interested in the possibility of expanding FLASH memory by connecting it via the parallel interface of the FSMC memory controller? Are you interested in the possibility of simultaneous operation of PSRAM and FLASH in Espruino? Will the execution environment see PSRAM and FLASH? Will the files on this extended memory be visible from the Espruino Web IDE?
As for @fanoush's comment, I suppose this is a special case, I also met many successful C++ projects on the STM32 series below STM32H7, which is discussed in the article 'Why you should fall in love with the RP2350' from @Dmitry.GR .
The STM32H7 crystals are significantly more complex than the F4xx series.
@Gordon please comment on the question! -
• #7
I think I covered this in my first message?
If you can memory map external RAM then great, Espruino should work with it (if you build your own firmware that inits PSRAM first).
Espruino can work with external Flash as storage too, it's just slower - and either you need to have memory mapping and to have ensured the flash write command works, or to copy a bunch of code from the nRF52 port to make this work.
-
• #8
Thanks for the clarification!
Nevertheless, I will clarify the situation a little. In the current version of the Espruino firmware, for example, the STM32F407 can theoretically work with external PSRAM memory, but there is no corresponding setting of the FSMC controller in the current Espruino code? Therefore, Espruino will not pick up PSRAM from the "box", did I understand correctly?
It turns out that in the STM32L496GDISCOVERY debugging board, for which there is also an Espruino firmware and for which an approximate number of variables is specified - "19200", this amount is obtained only due to the SRAM built into the STM32 and in this firmware, external PSRAM memory is also not available, although it is soldered on the debugging board, did I understand correctly? -
• #9
Yes to all. I think we already said the same thing 3 times in slightly different ways. And each time I fail to see how it could be interpreted in any other way :-)
On the other hand none of you explained how do you plan to use the memory, what kind of data will be there. Both external ram and flash will be slower than the internal one so just joining them (or even just using the external one only) will make things to run slower and use more power.
As for STM32L496GDISCOVERY when quickly googling psram I just found this unanswered topic https://community.st.com/t5/stm32-mcus-products/stm32l496g-discovery-psram-problem/td-p/355263 and then Zephyr support info for this board https://docs.zephyrproject.org/latest/boards/st/stm32l496g_disco/doc/index.html with psram not supported and then this https://stackoverflow.com/questions/57274543/fmc-slower-than-qspi-on-stm32h7
Hello!
For out Espruino project we're planning to use STM32 F4 Discovery. However there's one noticable downside - it doesn't have enough memory for what we're planning to do. To compensate that we're going to try to use PSRAM, which is supported by the chip, and external Flash.
My question is: How likely it is, or is possible at all, for Espruino to have memory conflics accessing RAM/PSRAM/Internal flash/External flash? Or to put it simply: are there any known memory issues with described approach?
Thanks!