note to self

when using GCC to do all-in-one linking, the order of library flags matters.

STM32F4 compiling under linux (with hardfloat!)

  1. Get a patched version of summon-arm-toolchain
  2. clone https://github.com/jeremyherbert/stm32-templates
  3. cd to the “stm32f4-discovery” folder
  4. run make
  5. enjoy hardware floating point support

To add hardfloat support to your own projects, use the compiler flags:

-mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16

STM32VL Discovery experiments

Picked this board up a while back and decided to start playing with it. They do *not* make it easy to use open source tools (or provide decent documentation).

This is CMRRRRRRRRRRRRRRRRR!

This is CMRRRRRRRRRRRRRRRRR!

FPGAs are really cool

it’s so refreshing to do digital signalling without having to use interrupts.

cnc getting closer

cnc getting closer

Been building an ECG for a few days solid, I can see my heart beating!

Been building an ECG for a few days solid, I can see my heart beating!

Just got back from hiking the Overland Track; over 100km in 7 days!

Just got back from hiking the Overland Track; over 100km in 7 days!

interrupts are not to be messed with

I came across an interesting bug while working with one of my students today. His AVR would continuously reset unless interrupts were switched off, but he needed them on for his project. This might seem pretty baffling (it was to me for a few minutes), but if you sit down and think about the code from an assembly perspective it should be obvious what was going on. Try and work it out!

————-

Not sure?

When compilers generate an interrupt table, they fill all of the unused vectors with something equivalent to

rjmp 0x0000 ; jump to reset vector

This protects the interrupt table from being filled with random data and causing random jumps (which can do bad things to your hardware). Unfortunately, if you enable interrupts and then trigger one without writing a handler (ie overriding this vector), you cause a chip reset. It turns out that the student had a timer interrupt firing very quickly and hadn’t written a handler for it.

Just goes to show that some assembly knowledge is useful, even for high level programmers.

laser-related epiphany

just realised how the optics in a laser cutter works. Laser tube is mounted parallel to the gantry/gantry rail attachments with 3 mirrors: one 45 degree which redirects the beam from the laser tube down the gantry rail, one 45 degree on the gantry which redirects the beam across the gantry and one rotated 45 degrees down the z axis to redirect the beam into the material to be cut.

bloody sickness gives me time to think!