Commit Graph

18 Commits

Author SHA1 Message Date
Benoît Thébaudeau
19fd7a3551 Use additive offsets
OR-ing an offset to a base address instead of adding it is dangerous
because it can only work if the base address is aligned enough for the
offset.

Moreover, if the base address or the offset has a value unknown at
compile time, then the assembly instructions dedicated to 'base +
offset' addressing on most CPUs can't be emitted by the compiler because
this would require the alignment of the base address against the offset
to be known in order to optimize 'base | offset' into 'base + offset'.
In that case, the compiler has to emit more instructions in order to
compute 'base | offset' on most CPUs, e.g. on ARM, which means larger
binary size and slower execution.

Hence, replace all occurrences of 'base | offset' with 'base + offset'.
This must become a coding rule.

Here are the results for the cc2538-demo example:
 - Compilation of uart_init():
    * before:
        REG(regs->base | UART_CC) = 0;
        200b78:	f446 637c 	orr.w	r3, r6, #4032	; 0xfc0
        200b7c:	f043 0308 	orr.w	r3, r3, #8
        200b80:	2200      	movs	r2, #0
        200b82:	601a      	str	r2, [r3, #0]

    * now:
        REG(regs->base + UART_CC) = 0;
        200b7a:	2300      	movs	r3, #0
        200b7c:	f8c4 3fc8 	str.w	r3, [r4, #4040]	; 0xfc8

 - Size of the .text section:
    * before:	0x4c7c
    * now:	0x4c28
    * saved:	84 bytes

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-03-28 17:28:15 +01:00
Enrico Joerns
cfbd4d49bf [cpu/stm32w108] Doxygen grouping and group name fixes 2014-11-10 23:53:33 +01:00
Enrico Joerns
0b8769e576 [doc] Various fixes for doxygen grouping etc. 2014-11-10 23:53:32 +01:00
Rémy Léone
8c3fa17ec0 Correct several doxygen tags (\file) 2014-07-28 11:11:45 +02:00
Rémy Léone
f111058472 Removing trailing whitespaces 2014-06-30 20:01:05 +02:00
Adam Dunkels
bb2dcaa057 A massive all-tree automated update of all double inclusion guard #defines that changes from using two underscores as a prefix, which are reserved, to not using two underscores as a prefix 2013-11-24 20:20:11 +01:00
stefano pascali
fcb09d5d30 Fixed mbxxx platform 2013-07-11 17:56:17 +02:00
Adam Dunkels
a5046e83c7 Cleanup and refactoring of the STM32w port
This is a general cleanup of things like code style issues and code structure of the STM32w port to make it more like the rest of Contiki is structured.
2013-03-18 13:31:26 +01:00
Salvatore Pitrulli
5eabf33211 Added functions for deep sleep to mbxxx platform. 2011-04-27 18:12:23 +02:00
Salvatore Pitrulli
01a7a78a94 Fixed temperature ADC conversion bug on mbxxx.
The conversion was made from an incorrect source when
the GPIO pin was not PB7.
Added functions and macros used to select the correct
ADC channel.
2011-04-20 18:06:20 +02:00
Salvatore Pitrulli
0a0ad39c9b Added weak symbols for STM32W exception handlers and other minor updates for the HAL. 2011-04-14 08:06:13 +02:00
Salvatore Pitrulli
57163c616d Removed some warnings. 2011-04-14 08:05:21 +02:00
Salvatore Pitrulli
eb588f1aec New HAL and SimpleMAC for STM32W108. 2011-03-22 19:35:49 +01:00
salvopitru
5fe80dd99d Added elfloader machine dependent code for STM32W. 2010-12-15 11:10:20 +00:00
salvopitru
28e1445a0f Added a simple implementation of Coffee for STM32W108. 2010-11-10 11:20:44 +00:00
salvopitru
db3f1864a0 Increased minimum stack size, because rpl uses it much more. 2010-10-26 11:07:20 +00:00
salvopitru
444a00949a Added missing libraries. 2010-10-26 10:24:17 +00:00
salvopitru
ec5e3ce0d7 New Contiki port to STM32W108. 2010-10-25 09:03:38 +00:00