Searduino 0.9 released
Searduino is an Arduino simulator and a C/C++ development environment for Arduino boards.
NEWS in Searduino 0.9
Upload and verify for Arduino boards.
It is now possible to use Jearduino to verify(build) and upload code for physical Arduino boards. Makes it easy to test in simulator and with two clicks upload it to a physical board.
Loading a file again will actually reload it.
Needed when rebuilding code. Previously the Arduino code didn’t get reloaded if loading the same file name as currently loaded.
No crash when halting and reloading dyn files.
Earlier versions sometimes crashed when halting and reloading a file containing Arduino code.
LCD correct after halt and start.
Earlier versions had the previous LCD data incorrectly stored and displayed when rotating left/right.
Source code dist
One annoying bug has been fixed. When reloading Arduino code the LCD data from previous execution was kept if rotation was in use. Ok, probably not the most important bug – bug it was one of them potential “something bigger is really the problem” bugs. It was an easy fix, although hard to find, and there were no signs of a bigger bug, so I guess we’re ready to release.
Next thing is to wait for a nice network connection. The hotel here in Auckland (NZ) doesn’t allow for ssh, let alone the poor speed. So tomorrow, when at the Auckland University of Technology, 0.9 will be released.
Some days ago we made Searduino work way better. Jearduino/Searduino only crashed every 2000 time. Way better than every second time. Still not really a sign of something working is it… and really hard to let go of ;)
After some more hours we found the problem…. Searduino (the simulator engine) may call the function callback after they’ve been closed (dlclose). Quite easy to fix and frustratingly obvious (as always) once you found the bug.
Now, with some ugly printf/println we’ve tested more. We tested for 20 hours and after 381,687 runs with:
we got no crashed. The code is merged so we’re going to focus on regression tests. After that,iIt’s about time to release 0.9.
We’ll give the release a nickname since Henrik is in New Zealand while the release is made. 0.9 will be called “kiwi”….. if nothing really bad happens.
Jearduino (the Java GUI frontend to Searduino) is using JNI to load the Searduino (in practice the Arduino Simulator Engine). When doing this two techniques are in use:
Jearduino loads a dynamic library (dlopen), finds a symbol (dlsym) and then starts a new thread (pthread_create) using the symbol found. When the user requests the thread to stop calls to pthread_cancel and to dlclose are made (looks a bit different in git right now, so this refers to my (Henrik’s) local git repo.
Since the user (rightfully) expects the simulator to execute freshly built code rather than the code before the build the same amount of call to dlclose as to dlopen must be made. Why? – dlopen keeps a reference count and if the ref count is not zero it does not load the file but reuse the previously loaded file. Uh oh – so the user thinks (I would at least) think that the new code is run but it isn’t. So we have written some code to make sure the latest code is actually loaded.
Ok, but what is the problem? ….get on with it you stupid bastard!!
Problem is that the pthread_cancel and the dlclose seemed to occasionally crash the program when occurring to closely in time. So a couple of sleep (usleep) has been added after the call to pthread_cancel. We all hate adding sleep but in this case it does not do any harm to the user – only to use as hackers. It seems to work though, so we’re keeping it. Will try to find a real solution – with no sleeps – later on.
So right now, one laptop is running tests since some hours ago. The tests are loading/running/closing code all the time… and so far 2249 runs with no crashes (compared to 1-2 runs before a crash before)….. will run the tests all night.
Yeah, some words about preparing. We’ve added quite a few features to make Searduino (in practice Jearduino) more user friendly. Once these tests pass it’s time to release 0.9 and reestablish contact with the nice Debian people since we think Searduino is good enough to put in there now.
It is now possible (only in git) to build for and upload to real Arduino boards.
Before release we will do a major code cleanup in the Java GUI. The information about the states are really scattered all over so before someone actually reads the code we will try to hide all traces.
News in 0.8
Better integration with Arduino.
With this release it is possible to import an Arduino file in to the GUI Simulator (jearduino) and have the code automically built and loaded so you can run your Arduino code. The resulting C code is stored in ~/searduino/<ino-example>.
New menu items
- Import Arduino examples (ino files)
- Import an Arduino file which results in a Searduino project ready for use in simulator
- Searduino projects
- Work with directoris containing Searduino code
- when having a project loaded
Other GUI changes:
- Tabbed paned
- extra tab with logs from arduino sim engine
- open manual in browser
New command line arguments:
- –arduino-code <FILE> – loads <FILE> for use
- –board <BOARD> – sets <BOARD> to use
- –start – starts your code as soon as it is loaded
New command line arguments:
- –searduino-project <di> – load searduino project dir
- bin/searduino-builder – to ease up builds
- bin/searduino-stream.sh – wrapper for streamed simulator
- share/searduino/settings – conf file for Searduino (logs etc)
- share/searduino/functions – basic bash functions for scripts and wrappers
New implemented API functions:
- none / not any
- Wrong month in logs
… and a screenshot