Boot / No Boot

Today while cleaning I found an old stm32 board carrying an STM32F030F4P6.

Turns out that PlatformIO supports it so just for fun I tried to blink some lights.

I couldn’t find my stlink at home but openocd can use a buspirate as a programmer.

It took a while to upload but after that I was able to launch gdb.

And the light was dead.

Strangely enough poking at the memory showed that the code indeed was there. After a long pause to think I noticed that the boot 0 jumper was misplaced.

The lights flashed and there was much rejoicing.

A very apt metaphor

“we don’t have electricity on the south side of the building, but I know water conducts electricity, so just connect the water main to the power grid, then install an outlet in every faucet”

Brad Montgomery on what we do as software engineers. Original at https://bradmontgomery.net/blog/blue-collar-programmer/

I don’t know why or how I ended up at that post but that situation evokes many fond memories of failed attempts at explaining what I was doing sometimes.

For all of its sins (or our inability to understand it back then) XML coupled with XSLT & friends is a nice basis to do ETL transformations.

Hey, I wrote an assembler.

(It was about time I interrupted a never ending pile of drafts with something)

So, for a bit more than a month I’ve been attending a seminar on VHDL microcontroller design.

One of the workshops involved doing some simple exercises on eval boards. While the overall instruction set is small (fits on less than a page) the idea of programming and then assembling the sources using pencil and paper wasn’t very appealing at the moment.

It sure is a fun way to keep the mind fresh but given time constraints I couldn’t cope with such a long debugging cycle.

And… The obvious path was to build a tool.

I reused parts of python-lx200 because smart data structures and dumb code are nice. Most of this could be implemented with M4 too, perhaps for another code golf session.

A couple of years ago I’d probably tried to use Bison and Flex but doubt that I could manage something like this in just a handful of hours during the weekend.

There are some rough edges but as it is it supports labels, variable definitions and emits a valid IHEX file. I made a couple of dumb mistakes but they were really evident when looking at what Quartus made of the output file.

I’m quite proud of the result, I don’t know when was the last time I had so much fun doing a one off project, even if it wouldn’t be used anymore after the seminar.

The source code lives here: https://github.com/pardo-bsso/islyd-asm

Weird Dreams

The other day I had a strange dream.

I was at a lounge talking with a waitress and we were doodling nonsense on a napkin. My drawings slowly morphed into something that was a lot like a Hilbert curve but not quite.

Our talk drifted into space filling curves and I kept trying to draw it but even tough I knew how it should look I always managed to draw something like a very simplified sandcastle.

Wisdom

Quite a while ago (in the last century nonetheless) my idea of a productive day entailed writing a lot of code, measured by size in any suitable metric.

Lately I’ve been writing less in volume but I realize that I spend a greater time thinking about the problem at hand as a whole and that it happens mostly in the background while I’m doing something else. By the time I’m again at the workstation everything falls into place.

Also, when stepping aside and contemplating whatever I engineered I can’t help to feel anything but pride. Perhaps except for the documentation I build things from the get go thinking of what I would like to have were I a library user, on terms of building blocks.

During the last two weeks I built a library to parse a protocol called LX200 used to control telescopes and I can’t be happier with the result (for now it’s at https://github.com/telescopio-montemayor/python-lx200 ). The first one was a roller coaster, due to some other issues I went back to a night owl schedule and I can’t remember when was the last time I had such prolonged and intense periods of flow. I also taught myself asyncio.

It’s terse, concise, and (mostly) well structured. My former self would’ve made a mess of a state machine tied together with pages of if statements that worked, for sure, but was a pain to extend or correct. Of course looking down the path and leveraging years of experience this things seem obvious now.

Coincidentally, the other day Eric wrote about the advantage of declarative/table driven approaches.

It gets better

I spent most of the last weekend studying and a bit sick.

When not reading for the Uni I binge watched a lot of talks from previous editions of the CppCon, because that’s obviously what only a sick person would do.

And after not being on that scene for quite a while I found that, like for some wines, the time made it nicer.

The use of auto variables when iterating containers, lambdas, parallelization and inclusion of atomic operations (albeit I believe they are insufficiently documented and will bite a lot of people) are just some of the things that surprised me in a good way. There’s a host of cool stuff under <algorithm> and the new optimizations (like the ones carried for constexpr ) are incredible.

Coincidentally, Bert Hubert started a series of posts with the good parts of C++ that actually makes me want to code something in it again.

Sharing is caring.

Some contributions to open source projects that got merged. It’s a pity that most of the work I do has to be private but that’s going to change soon.

https://github.com/voxmedia/autotune/pull/391
https://github.com/voxmedia/autotune/pull/396
https://github.com/LimeSurvey/LimeSurvey/pull/793
https://github.com/LimeSurvey/LimeSurvey/pull/795
https://github.com/indilib/indi/pull/337

The folks at LimeSurvey are really nice and the process was super smooth.
The last one was very tricky, just a misplaced paren that completely changed the meaning of an error check.

PyConAR 2016 Days 1, 2 and 3

The first day we were quite busy handling the admission and all that stuff at Club Emprendedores Bahía Blanca, so no pictures (at least from me, there are others from the official photographer)

The following days were at Complejo Palihue. It’s a lovely campus at the outside of the city within very wealthy neighborhoods.

The lecture rooms and amphitheaters are ample and well stocked and the view is lovely:

I also spent a while at our booth

And attended to a couple of talks. This one is about MicroPython running on the EDU-CIAA

A small detour on my way to PyConAR 2016

It’s that time of the year (again) when I rent a car and hit the route.

This time I’m heading to Bahía Blanca in order to help a bit and attend to PyConAR.

At the side of Ruta 51 on Coronel Pringles, a bit after the crossing with Ruta 72 there’s a wonderful lake.
Even if there were about 60 kms left I had to stop to enjoy the day and stretch a bit my legs.

Doomed

So, I’m facing an issue and the best tools so far (or the ones that are the less worse) seem to involve both php and xslt. And a braindead webservice. Go team.
Not totally unrelated, I’m surprised at the amount of stuff that can be found with “depressed developer”.

Why do I even bother…

I tell you it’s for your own good people but no, you keep doing the same horrible things.

While bisecting a nasty bug I land into a monster commit:


$ git show --stat THE_COMMIT_HASH
commit 123456789A04a0d558749337badc0de9deadbeef
Author: root
Date: Tue Aug 4 09:10:16 2015 -0300

THE PROJECT NAME.-THE AUTHOR HANDLE
(files changed...)
38 files changed, 865 insertions(+), 657 deletions(-)

And this is one of the smaller ones. It updates vendor libraries, adds middlewares to our api, changes the authentication scheme and does some touch ups to the web frontend. I couldn’t care less that it was committed as root but the log message is murder to my eyes.

How hard is to understand that doing this is bad for everyone? It’s very easy to do this instead of making a couple of extra commits but when things break you come crying asking me to fix them and instead of being a simple task I have to sift through mountains of unrelated stuff.

You are more than welcome.