Fast integer scaling on Cortex-M0

Integer scaling is very common in embedded systems. For example to make human-readable values of ADC readings (correcting for gain or voltage dividers). Two operations are needed to do scaling without using floating-point numbers – multiplication and division. Cortex-M0 is a nice little beast with a single cycle integer multiplier. ARM provides a smaller area 32-cycle multiplier but I have not yet come across a chip that would have it. All chip makers seem to choose the faster option. Cortex-M0 however totally lacks integer division. Division is handled by library functions. A simple code like y = x * 123 / 120; gets compiled to a function call. Software division of course takes time (and energy). There is a nice hack though 🙂
Continue reading “Fast integer scaling on Cortex-M0”

Reducing FFT code size of CMSIS DSP

Fatal error: Uncaught Error: Call to a member function id() on array in /usr/home/filo/domains/m0agx.eu/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php:36 Stack trace: #0 /usr/home/filo/domains/m0agx.eu/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php(538): CrayonFormatter::format_code('', Array, Object(CrayonHighlighter)) #1 [internal function]: CrayonFormatter::delim_to_internal(Array) #2 /usr/home/filo/domains/m0agx.eu/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php(516): preg_replace_callback('#()#msi', 'CrayonFormatter...', 'arm_status arm_...') #3 /usr/home/filo/domains/m0agx.eu/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_highlighter.class.php(166): CrayonFormatter::format_mixed_code('arm_status arm_...', Object(CrayonLang), Object(CrayonHighlighter)) #4 /usr/home/filo/domains/m0agx.eu/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_highlighter.class.php(186): CrayonHighlight in /usr/home/filo/domains/m0agx.eu/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 36