In theory, you can disable features by tuning them off in the mpconfigport.h file.
Since nobody has tested this, I'm sure that there will be wrinkles.
The way that flash works, you can only set bits to zero. To set a bit to 1 you need to erase the entire page (which may be 128K) which sets all of the bits to 1. The file system is arranged as 512 byte blocks, so to update a sector which already has bits in it (like the directory containing the file entry) you need to copy the contents of the old flash block into RAM, modify it, erase the page in flash and write the updated RAM copy back.
So even creating a zero byte file still needs 128K bytes of RAM (if you're dealing with 128K flash pages. The pyboard has some 16K and 64K flash pages, and these are used for the filesystem (except for the very first 16K page which contains the interrupt vectors). The 112K comes from 3x16K + 1x64K and we have to reserve 64K of the 192K of RAM just to allow this to happen.
SPI flash ... TODO
-
- Posts: 15
- Joined: Mon Jun 01, 2015 4:36 pm
Re: SPI flash ... TODO
Hi,
step #1, set oprions, ok
#define MICROPY_HW_BOARD_NAME "PYBv1.0"
#define MICROPY_HW_MCU_NAME "STM32F405RG"
#define MICROPY_PY_SYS_PLATFORM "pyboard"
#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_HAS_SDCARD (0) // sd card
#define MICROPY_HW_HAS_MMA7660 (0) // 3-Axis Orientation/Motion Detection Sensor
#define MICROPY_HW_HAS_LIS3DSH (0) // ultra low-power high performance 3-axes nano accelerometer
#define MICROPY_HW_HAS_LCD (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_TIMER (1)
#define MICROPY_HW_ENABLE_SERVO (0) // servo motor
#define MICROPY_HW_ENABLE_DAC (1)
#define MICROPY_HW_ENABLE_CAN (0) // can bus
Step #2 compile, ok
Step #3 update PYBV10, ok
Step #4 how to resize the flash ?
Best regards,
Oscar.
step #1, set oprions, ok
#define MICROPY_HW_BOARD_NAME "PYBv1.0"
#define MICROPY_HW_MCU_NAME "STM32F405RG"
#define MICROPY_PY_SYS_PLATFORM "pyboard"
#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_HAS_SDCARD (0) // sd card
#define MICROPY_HW_HAS_MMA7660 (0) // 3-Axis Orientation/Motion Detection Sensor
#define MICROPY_HW_HAS_LIS3DSH (0) // ultra low-power high performance 3-axes nano accelerometer
#define MICROPY_HW_HAS_LCD (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_TIMER (1)
#define MICROPY_HW_ENABLE_SERVO (0) // servo motor
#define MICROPY_HW_ENABLE_DAC (1)
#define MICROPY_HW_ENABLE_CAN (0) // can bus
Step #2 compile, ok
Step #3 update PYBV10, ok
Step #4 how to resize the flash ?
Best regards,
Oscar.
Re: SPI flash ... TODO
If you're trying to increase the size of the internal flash filesystem, then can't (at least not easily) due to the reaons I mentioned in the previous post.
The pyboard has 1 Mb of flash arranged as follows
1 x 16k page (used for ISR vectors)
3 x 16k pages (used for filesystem)
1 x 64K page (used for filesystem)
7 x 128K pages (used for code).
The current firmware image uses 3 of the 128K pages for the code.
Since there isn't a free 128K RAM block, you can't use the 128K pages for the filesystem. If you wanted, you could use 64K of each page. This would require modifying stmhal/storage.c and possibly moving where the firmware gets loaded.
Another, much simpler option, is to use something called frozen modules. This essentially puts the python source code for modules into flash (albeit in a non-changable manner).
I don't think that the stmhal Makefile currently has the glue in it for frozen modules, but the unix and teensy Makefiles do.
The pyboard has 1 Mb of flash arranged as follows
1 x 16k page (used for ISR vectors)
3 x 16k pages (used for filesystem)
1 x 64K page (used for filesystem)
7 x 128K pages (used for code).
The current firmware image uses 3 of the 128K pages for the code.
Since there isn't a free 128K RAM block, you can't use the 128K pages for the filesystem. If you wanted, you could use 64K of each page. This would require modifying stmhal/storage.c and possibly moving where the firmware gets loaded.
Another, much simpler option, is to use something called frozen modules. This essentially puts the python source code for modules into flash (albeit in a non-changable manner).
I don't think that the stmhal Makefile currently has the glue in it for frozen modules, but the unix and teensy Makefiles do.
Re: SPI flash ... TODO
You won't be able to present the SPI flash to your PC over USB MSC with the standard software. Instead you could use rshell to copy files to/from the SPI from the PC.
To get an extra 64k of flash space you can enable the option at line 46 of stmhal/storage.c (make the "0" a "1').
To get an extra 64k of flash space you can enable the option at line 46 of stmhal/storage.c (make the "0" a "1').
-
- Posts: 15
- Joined: Mon Jun 01, 2015 4:36 pm
Re: SPI flash ... TODO
Hi Dhylands and Damien,
thanks for the advice and clarification.
I had set the +64k option, how can I compile "frozen modules" on PYBV10 ?
Best regards, Oscar.
thanks for the advice and clarification.
I had set the +64k option, how can I compile "frozen modules" on PYBV10 ?
Best regards, Oscar.
-
- Posts: 15
- Joined: Mon Jun 01, 2015 4:36 pm
Re: SPI flash ... TODO
Hi to all,
and thanks for the support,
I have to other questions about the uSD card and the SPI flash memory
For the uSD card it's possible use python for format the uSD FAT-FS if is not?
And about the SPI Flash I'm going to do some test with the class flash.py from
https://github.com/peterhinch/micropython-epaper
How can I write/read more file in the SPI Flash ?
Best Regards,
Oscar.
and thanks for the support,
I have to other questions about the uSD card and the SPI flash memory
For the uSD card it's possible use python for format the uSD FAT-FS if is not?
And about the SPI Flash I'm going to do some test with the class flash.py from
https://github.com/peterhinch/micropython-epaper
How can I write/read more file in the SPI Flash ?
Best Regards,
Oscar.
Re: SPI flash ... TODO
On the pyboard it currently isn't possible. I believe that it might be exposed on the WiPy.oscar.lambri wrote:Hi to all,
and thanks for the support,
I have to other questions about the uSD card and the SPI flash memory
For the uSD card it's possible use python for format the uSD FAT-FS if is not?
There is an example here:And about the SPI Flash I'm going to do some test with the class flash.py from
https://github.com/peterhinch/micropython-epaper
How can I write/read more file in the SPI Flash ?
https://github.com/micropython/micropyt ... /sdcard.py
When you use the pyb.mount command, then there is an option to format the file system
http://docs.micropython.org/en/latest/l ... #pyb.mount
however, I don't see any way to use that for the builtin sdcard
-
- Posts: 15
- Joined: Mon Jun 01, 2015 4:36 pm
Re: SPI flash ... TODO
OK, thanks for the your reply,
Oscar.
Oscar.