osd-contiki/cpu/cc2538
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
..
dev Use additive offsets 2015-03-28 17:28:15 +01:00
usb Changed the name of the rimeaddr module to linkaddr 2014-01-29 20:12:24 +01:00
cc2538.lds CC2538: Add FLASH_CONF_ORIGIN and FLASH_CONF_SIZE config parameters. 2014-05-02 11:35:58 -04:00
clock.c Use additive offsets 2015-03-28 17:28:15 +01:00
cpu.c New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
cpu.h Re-structure CC2538 doxygen module hierarchy 2015-02-16 10:17:58 +01:00
dbg.c cc2538: uart: Make it possible to use several UARTs simultaneously 2014-04-17 18:53:44 +02:00
dbg.h Improve wording 2015-02-16 10:17:58 +01:00
debug-uart.h New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
ieee-addr.c Improve documentation for the CC2538 IEEE address re-ordering 2014-06-06 18:33:28 +01:00
ieee-addr.h Make the CC2538 secondary IEEE address location configurable 2014-06-06 18:15:07 +01:00
lpm.c Merge pull request #472 from ADVANSEE/cc2538-clock-adjust-etimer-poll 2014-04-13 16:35:17 +01:00
lpm.h cc2538: lpm: Fix build for LPM_CONF_ENABLE == 0 2014-01-28 20:21:06 +01:00
Makefile.cc2538 Merge pull request #616 from hexluthor/listing 2014-04-17 22:13:52 +01:00
mtarch.h 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
reg.h New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
rtimer-arch.c cc2538: lpm: Fix RTIMER_NOW() upon wake-up 2013-12-05 20:23:29 +01:00
rtimer-arch.h New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
slip-arch.c cc2538: uart: Make it possible to use several UARTs simultaneously 2014-04-17 18:53:44 +02:00
spi-arch.h Re-structure CC2538 doxygen module hierarchy 2015-02-16 10:17:58 +01:00