hello

MQX is an Operating system from Freescale available for a number of their
Mid range processors. I have started the task of porting Sqlite to run on a
Coldfire V4. MQX is not as full featured as the Windows, Unix etc ports, so
it is going to be a challenge. If I ever manage to get this to work, I will
put the code in the public domain and write up some notes on how I did it
and problems I hit. The Sqlite doumentation web pages are great for running
code on a Windows OS, but are a bit light on detail for folks that are
trying to port to other OS's particularly what I call the mid-range OS's E.G 
ThreadX, Nucleus, MQX etc

I have so far implemented the memory handling functions for MQX, and the
majority of the file operation functions so I thought I would try some
initial debugging with a simple externally created database running
sqlite3_exec() and "SELECT * from tbl1"  (non threadsafe is defined to
simplify the problem)

Not totally unexpectedly but it is currently crashing when I run it, and I
cant see what is wrong.

I have added some debug printfs to both my Windows version and my MQX
version
Windows version gives me

File opened OK
Read 100  Got 100
sqlite3_exec called
sqlite3_exec called
sqlite3_step returns 101  callbackinit = 0
Read 1024  Got 1024
sqlite3_exec called
sqlite3_step returns 100  callbackinit = 0
sqlite3_exec called
sqlite3_step returns 101  callbackinit = 0
sqlite3_step returns 100  callbackinit = 1
sqlite3_step returns 101  callbackinit = 1
sqlite3_exec called
sqlite3_step returns 101  callbackinit = 0
Read 16  Got 16
Read 1024  Got 1024
sqlite3_step returns 100  callbackinit = 0
col1_Title = Two
col2_Title = 2
customer = John

sqlite3_step returns 100  callbackinit = 1
col1_Title = One
col2_Title = 1
customer = Bill

sqlite3_step returns 100  callbackinit = 1
col1_Title = Three
col2_Title = 3
customer = Albert

sqlite3_step returns 101  callbackinit = 1
File closed OK

This is the working version, the callback function prints out the 3 columns 
of data and all 3 rows from my test database. Also the test.db file is
opened right at the start and closed again at the end



MQX  Non working version shown below
File c:\test.db opened OK
Read 100  Got 100
sqlite3_exec called
sqlite3_exec called
sqlite3_step returns 101  callbackinit = 0
Read 1024  Got 1024
sqlite3_exec called
sqlite3_step returns 100  callbackinit = 0
sqlite3_exec called
sqlite3_step returns 101  callbackinit = 0
sqlite3_step returns 100  callbackinit = 1
File c:\test.db closed OK
sqlite3_step returns 101  callbackinit = 1
sqlite3_exec called
sqlite3_step returns 101  callbackinit = 0

*** UNHANDLED INTERRUPT ***

Several things to note here, there are 2 reads of 100 bytes then 1024, but
the subsequent ones in the window log dont get called. (Expecting 16 bytes
read as next read call)

None of my lower layer MQX calls are printing out any error lines, so I
think they are working OK

There is a premature call to close the database file, mid way through the
statement execution, so that is possibly why it crashes a few lines farther
on.

The code is very complex around where it is closing the db file and I have
not been able to figure it out so far. Here is the stack trace where it
calls the premature close

http://old.nabble.com/file/p27792715/stack.jpg 

I know its a long shot but does Dr Hipp or anyone have any possible ideas
what could give rise to a premature file close ?  Sorry my message was so
long. Thanks for any ideas

Geoff
-- 
View this message in context: 
http://old.nabble.com/Porting-Sqlite-to-MQX-Operating-system-tp27792715p27792715.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to