Tag Archives: C

Cortex-M0 Boot

stm32f0_img

Still alive and kicking. And with another year in my back in Embedded Development.

My recent tamperings have been about creating a bootloader for a Cortex-M0 µ-processor that performs firmware update either from UART or SPI.

There was a interesting bit on how to set-up the system to have two Firmwares running (Boot Mode and application mode). And that is what I’ll explain in this post. How to set up a project to build a boot and successfully run your main application.

Boot me up

3 Comments

Filed under code, electronic

Quick Unit testing with C

throwtheswitch

Unit testing is something that lots of developers are used to, and in environments like Python or Java can be even bundled in some awesome libraries. Easy to use, easy to implement, great results.

Then it comes C Embedded: The environment is different, even the people is different!!. Praising the benefits of unit testing is not that easy sometimes, even writing the unit test functions is not as straigtforward.

In this post, I’ll talk about Unity, a small unit test library for C.

See how we test

Leave a comment

Filed under code, tips

A 3×3 font for Led Matrices

fontIcon

For the clock project I require text to appear in a small container, that is 4×4.

Since in this 4×4 I have to add vertical and horizontal spacing this ends with a 3×3 font.

Never in my life I designed a font, and if you check my hand writing… it is horrible. Luckily 3×3 only leads up to 2^9 options, 512 different characters, and I believed I could handle this.

After writing the font in a squared notebook, I checked that other fronts already exist, and, unsurprisingly they were very similar to mine.

Show me your font

Leave a comment

Filed under code, curious, DIY

Numpy in C

C + numpy

When I was temporary working at my former university UPC (Universitat politècnica de Catalunya) in the TALP department (Center for Language and Speech Technologies and Applications), I found myself in the following situation:
My employers had a lot of python code creating matrices and stuff saved to .npy (numpy files) but wanted to speed up their processes.

I thought about loading those files in existing C code, to effectively use the GPU with OpenGL/CUDA. And once everyone was convinced, I spent some time developing a small library to do so, in the following post you will find an explanation of the numpy format and the code for the C library.

really? continue please

2 Comments

Filed under code, tools

Convex Hull, one algorithm implementation

chull
I talked about convex hulls some time ago in an alpha shape post.

The convex hull is probably one of the most basic computational geometry algorithms, and because of that it is present in almost, if not all, geometry/cad/gis libraries and software packages. In this post you will find an explanation of one of the existing algorithms to compute it, an implementation with C++, plus a set of scripts to generate various point clouds and the corresponding hulls.

Objective

  • Describe one of the possible convex hull algorithms
  • Implement the algorithm in C++
  • Provide various scripts to generate random point clouds and compute its convex hulls

I won’t lie to you, this post might be boooring ;-).

continue to this long post

3 Comments

Filed under code, gis

C Mask Creation & intel sal

c_logo
It’s been a while since I posted something, but recently I did not work in anything at all, just playing some Zelda and reading some books (and yes, I will post about the books someday).

Right to the matter at hand. It has been noted to me that my C skills are rusty (god damn it!), so I decided to play a little with it implementing a small dissassembler for ARMv7 binaries (just ARM instructions, no thumb or anything else). And indeed, I found myself in some trouble.
more

Leave a comment

Filed under code, curious