Qball's Weblog

Atmel Coding, Optimalisation

Tags atmel  General 

Hitting the 2k program space, I looked to improve the code size.

Realizing that using a 16bit value for bit-masks is quiet inefficient on a 8bit avr. Because I don’t store a value larger then 8bit in there, I split the 16bit variable into 2x8bit  variables.

This saves allot of cycles  moving stuff unneeded  around. It will also run faster, but this wasn’t bottleneck.

The actual gain was around 15%,  it now only uses 1792 bytes. So now I can add features again.

There is one optimalisation left todo, I store “Mon”,  “Tue”, etc in an array, this is constantly kept in sram. It would be nice if I could do this smarter, so it won’t use the sram.

Qball

p.s. still looking for features to add.