cancel
Showing results for 
Search instead for 
Did you mean: 

Using SQLite in STM32F407

Yamir.1
Associate II

I'm very new to stm32. I want to port SQLite to my STM32F407. I tried adding the SQLite amalgamation libraries to the code file but the code refuses to build due to several issues. I tried to search for a anything that describe how it's done in the internet but couldn't find anything. can someone who knows how it's done help me with this, or at least send me a link that describes how it's done? sorry if this is a dumb question

1 ACCEPTED SOLUTION

Accepted Solutions

As most libraries from the "big computers" world, SQLite expects to run an a full-fledged operation system, which provides file system among other things:

https://www.sqlite.org/selfcontained.html

Default builds of SQLite contain appropriate VFS objects for talking to underlying operating system, and those VFS objects will contain operating system calls such as open(), read(), write(), fsync(), and so forth. All of these interfaces are readily available on most platforms, and custom VFSes can be designed to run SQLite on even the most austere embedded devices.

The STM32 is the case of "most austere embedded device", so you are supposed to "design custom VFS", whatever that may mean (I am not interested in this at all).

JW

View solution in original post

5 REPLIES 5
Pavel A.
Evangelist III

What issues? If you are new to STM32 (and ARM in general) - expect all kinds of beginner complications.

Start from some simple examples.

If time is critical, find a consultant.

Yamir.1
Associate II

Basically what I did is adding the amalgamation code that SQLite provides in its website to the include and src folders in the code folder. I'm not sure if this is the correct way of doing it? when I try to build to see if the code compiled, I get several errors inside the SQLite files (sqlite3.c and shell.c).

For example in the sqlite3.c file in the "#define SQLITE3_MUTEX_INITIALIZER(id) { PTHREAD_MUTEX_INITIALIZER }" line I get "PTHREAD_MUTEX_INITIALIZER undeclared" and for "#include <sys/ioctl.h>" I get "No such file."

in the shell.c I get "unkown type DIR" for "DIR *pDir;" line. and for "if( pEntry->d_name[0]=='.' ){" I get "dereferencing pointer to incomplete type 'struct dirent'" alongside some warnings.

Is it a simple problem that I just dont know how to solve? because I couldnt find anyone asking this question

Thanks for your response btw!

I think I accidently responded as an answer rather than a reply. pls check what I posted.

As most libraries from the "big computers" world, SQLite expects to run an a full-fledged operation system, which provides file system among other things:

https://www.sqlite.org/selfcontained.html

Default builds of SQLite contain appropriate VFS objects for talking to underlying operating system, and those VFS objects will contain operating system calls such as open(), read(), write(), fsync(), and so forth. All of these interfaces are readily available on most platforms, and custom VFSes can be designed to run SQLite on even the most austere embedded devices.

The STM32 is the case of "most austere embedded device", so you are supposed to "design custom VFS", whatever that may mean (I am not interested in this at all).

JW

I see. I read about VFS and figured it has something to do with my problem but wasn't sure. I'll try to search on how it's done. thank you