arc: fix unaligned variables resulting in unaligned k_cpu_sleep_mode

Force-align all variables defined via asm .word to ensure 4-byte
alignment.

The straddled_tick_on_idle_enter variable was a bool, which resolved in
an one-byte quantity. Changing it to a 32-bit integer. It would have
occupied 4 bytes anyway with alignment.

Fixes ZEP-1549.

Change-Id: If5e0aa1a75dbc73d896b44616f059d221fe191c6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2017-01-12 16:49:58 -05:00 committed by Anas Nashif
commit 3c39e55ab1
4 changed files with 6 additions and 3 deletions

View file

@ -33,6 +33,7 @@ GTEXT(k_cpu_idle)
GTEXT(k_cpu_atomic_idle)
GDATA(k_cpu_sleep_mode)
.balign 4
SECTION_VAR(BSS, k_cpu_sleep_mode)
.word 0

View file

@ -45,6 +45,7 @@ GTEXT(__ev_div_zero)
GTEXT(__ev_dc_error)
GTEXT(__ev_maligned)
.balign 4
SECTION_VAR(BSS, saved_stack_pointer)
.word 0

View file

@ -38,6 +38,7 @@ GTEXT(_isr_demux)
#if CONFIG_RGF_NUM_BANKS == 1
GDATA(saved_r0)
.balign 4
SECTION_VAR(BSS, saved_r0)
.word 0
#endif

View file

@ -82,7 +82,7 @@ static uint32_t accumulated_cycle_count;
static uint32_t __noinit max_system_ticks;
static uint32_t __noinit programmed_limit;
static uint32_t __noinit programmed_ticks;
static bool straddled_tick_on_idle_enter = false;
static int straddled_tick_on_idle_enter;
extern int32_t _sys_idle_elapsed_ticks;
#endif
@ -251,7 +251,7 @@ void _timer_idle_enter(int32_t ticks)
status = timer0_control_register_get();
if (status & _ARC_V2_TMR_CTRL_IP) {
straddled_tick_on_idle_enter = true;
straddled_tick_on_idle_enter = 1;
}
__ASSERT_EVAL({},
uint32_t timer_count = timer0_count_register_get(),
@ -273,7 +273,7 @@ void _timer_idle_exit(void)
{
if (straddled_tick_on_idle_enter) {
/* Aborting the tickless idle due to a straddled tick. */
straddled_tick_on_idle_enter = false;
straddled_tick_on_idle_enter = 0;
__ASSERT_EVAL({},
uint32_t timer_count = timer0_count_register_get(),
timer_count <= programmed_limit,