c++ - How to store text file on embedded systems flash memory and read from it -
i'm trying following: storing text file (7kb) in flash memory of steval-mki109v2 (running freertos) board , read text file , doing computation on device itself. have 2 problems regarding that:
1) storing text file enough add text file keil project? can access after compiling?
2) accessing data that's failed until now. @ first tried using fopen() stdio.h got errors on compilation. found out project compiles using microlib seems doesn't include file i/o. after compiling standard c - library successful reach fopen part in code system crashes.
now don't know if reason text file not found or if cannot use fopen() on embedded system. didn't find further information inside stm documents or forums except flash_unlock(); function seems it's used writing.
do need store text file in way , access memory address instead of filename? i'm confused , cannot find information online.
thanks in advance help!
if want contents of file char-string, can convert file c source code e.g. using small python program (or other language, use python simple in python in c or c++ instance). create like:
const char my_text[] = { ... here goes text };
most simply, embrace each line "
.
then either add file project (you'll require extern declaration use it) or #include
, make declaration static
(thanks @clifford).
Comments
Post a Comment