Hacker News new | past | comments | ask | show | jobs | submit login

8 bit code takes much less space than 32bit code. You can almost pack in 2 to 4 times as much code in the same space as fixed instruction width 32bit code. Perhaps less when compared with ARM thumb but still significant.



You'd think, right? Luckily the ARM dudes came up with Thumb-2, so most (all but 6) of the Cortex-M0+ instructions are actually 16 bit, not 32. (Nice chart at http://en.wikipedia.org/wiki/ARM_Cortex-M .)

But what's even more interesting is to actually compile apps and compare code size. Miro Samek did this for a couple of RTOS-like framesworks and compared across a mix of 8, 16 and 32 bit micro architectures (PIC, 8051, M8C, 68HC08, AVR, MSP430, M16C, ARM7 Thumb, and ARM Cortex-M3 Thumb2). For his test, the MSP430 was the most dense, but Thumb2 wasn't far behind. (http://embeddedgurus.com/state-space/2009/03/insects-of-the-...)

Of course, there are 4 bit micros out there...


> ARM dudes came up with Thumb-2

I guess I'm nitpicking, but Cortex-M0+ and Cortex-M0 are basically Thumb only. The only Thumb-2 instructions implemented by these cores are the ones for barriers and transferring data between general purpose registers and special registers. These are:

1) Without an equivalent Thumb instruction

2) Required on the ARM architecture

3) A tiny, tiny percentage of instructions executed or just not used by typical application code.

Regarding the linked test, the toolchain and optimisation flags are going to make a significant difference. I wonder how GCC (which is free and probably the most popular) and armcc (which generally produces significantly better output) would fit in there.


Here's another interesting comparison of code density, in which x86 (not surprisingly?) came out ahead: http://www.researchgate.net/publication/224114307_Code_densi...


Flash memory used for program storage is much much cheaper than ram. One of the only wins that 8 bit code has over even thumb code is a faster instruction bus, but for a pipelined processor that doesn't matter anymore.

8 bit would be dead if the 32 bit parts included all of the peripherals engineers actually need to build stuff (SPI,analog,timers,etc).


There are lots of 32bit micros with all those peripherals, I think it's just that the embedded industry moves slowly and adopts new products with caution. I think it's only a matter of time before all microcontrollers are ARM and the various 8/16 bit architectures die off.


There are, but the AVR parts for example have an amazing balanced of needed peripherals that still makes those parts attractive. It Atmel replaced their AVR cores with a cortex-m0 but kept all the peripherals in place and the pinouts and the part numbering scheme the same, they would have a huge boost in market share.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: