Binary file when there is no file system

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Ephreal
Posts: 1
Joined: Tue Jan 15, 2019 1:41 pm

Binary file when there is no file system

Post by Ephreal » Tue Jan 15, 2019 1:49 pm

Hi

I'm using Micropython on a Nios 2 Softcore from Altera. I somehow need to load a image file into a Flash. I've tried to wrap this file into a Python string which I then could load from the processor it self. However due to how a string is processed in MicroPython this was not possible. There is generated a hash value for every string and the speed and size of this hash string is proportional with the size of the string length it self.

I do not have a files system on this Nios, all python modules are compile from the Memzip folder (no frozen modules though).

Is there a way to compile a binary file which can be imported or access in other ways through the REPL?

Regards
Ephreal

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

Re: Binary file when there is no file system

Post by dhylands » Tue Jan 15, 2019 8:55 pm

You can store the binary file on the file system if there is enough space.

Otherwise you might want to look at the font code that Peter Hinch (@pythoncoder) did over here:
https://github.com/peterhinch/micropython-font-to-py
which embeds binary font data into a python source file.

Post Reply