I made a program to load applications to RAM and run them in the Stellaris Launchpad. On reset, it reads an SREC file from the serial port and copies it to RAM. It points the vector table to the load location (so interrupts work normally) and jumps to the application’s
The first problem was reserving RAM for the loaded application. To do this, I modified my linker script by splitting the RAM into two sections, and keeping the loader in the first section.
Afterwards, the application has to be linked so that it will run from RAM. This means using another linker script that puts it on the second section of RAM. It also places the vector table at the beginning so that the loader knows where it is.
The loader itself is a minimal SREC parser which implements the records that showed up in my SREC files.
To play around with the loader, it’s possible to make SREC files from the SDK example projects. This requires changing the entry point and linker script in the Makefile. For example, to compile project0 we change
. Then we have to change the startup script in
startup_gcc.c . Normally the reset routine would copy data from Flash to RAM to initialize variables, but this isn’t necessary when running from RAM. So comment out
ResetISR and change the reset vector to
(void (*)(void) main.
After these changes, the AXF file generated by
make will be good for running from RAM. To get the SREC file, use
sed to strip the header:
arm-none-eabi-objcopy -S -O srec --srec-len=8 project0/gcc/project0.axf project0/gcc/project0.srec
# Strip header
sed -i /^S0/d project0/gcc/project0.srec
I’ve automated this last step with a rule in the Makefile. This works successfully with
qs-rgb and probably all the other example projects.
I wrote a simple app to triangulate Strongholds in Minecraft. Instead of wasting a bunch of Eyes of Ender trying to get to a Stronghold, you can just do a couple of throws and get a good estimate of its position.
You can check out the app or look at the source code
I wrote a set of Python bindings for the Ngspice simulation engine. It’s meant to add the clarity and power of Python to electronics simulations. For instance, you can simulate a circuit while varying different parameters and produce highly customized plots of your results, while minimizing your exposure to SPICE syntax.
More details on the project page.
I made templates you can print out to build the Wigner-Seitz cells for hexagonal, body-centered cubic and face-centered cubic crystals. Check out the ideal result:
And the actual result:
You can print these out to build your own:
I used blender to model the cells in 3D and UV-unwrapped them into svg files. These I edited with inkscape to add the edge tabs.
I had some trouble deploying a Flask app with Apache2, so here’s a minimum working configuration.
Virtual environment setup
pip install flask
mkdir -p src/appname www
echo "site.addsitedir(os.path.join(base, 'src'))" >> bin/activate_this.py
echo "from .appname import *" > src/appname/__init__.py
cat > src/appname/appname.wsgi <<EOF
activate_this = '/path/to/virtualenv/bin/activate_this.py'
from appname import app as application
cat > src/appname/appname.py <<EOF
from flask import Flask
app = Flask(__name__)
if __name__ == '__main__':
Virtual host configuration
Allow from all
WSGIScriptAlias /connote /path/to/virtualenv/src/connote/connote.wsgi
WSGIDaemonProcess host.name processes=2 threads=15
Allow from all
I’ve been playing around with Monte Carlo simulations of the Ising model. The idea is that you have a grid of dipoles (think bar magnets) which interact with their neighbours. They can point up or down, and they feel a force from their neighbours which tends to make them parallel. However, there’s also random thermal motion which flips them randomly.
Depending on the ratio of interaction energy to thermal energy, different behaviors emerge from the lattice. The most interesting one is that below the critical temperature, the lattice spontaneously magnetizes, meaning there’s an imbalance between up and down. This models what happens in ferromagnets, which can retain magnetization if they are below the Curie temperature.
Here is the simulation code and a pretty video.
I’ve been playing around with RenderScript and found a problem only referenced in this StackOverflow question. Unfortunately, my solution brings another problem with it because it makes the app incompatible with my cellphone.