2015-04-11 01:44:37 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 Wind River Systems, Inc.
|
|
|
|
*
|
2015-10-06 18:00:37 +02:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2015-04-11 01:44:37 +02:00
|
|
|
*
|
2015-10-06 18:00:37 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-04-11 01:44:37 +02:00
|
|
|
*
|
2015-10-06 18:00:37 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2015-04-11 01:44:37 +02:00
|
|
|
*/
|
|
|
|
|
2015-12-04 16:09:39 +01:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Reset handler
|
|
|
|
*
|
|
|
|
* Reset handler that prepares the system for running C code.
|
2015-07-01 23:22:39 +02:00
|
|
|
*/
|
2015-04-11 01:44:37 +02:00
|
|
|
|
|
|
|
#define _ASMLANGUAGE
|
|
|
|
|
2015-09-13 00:49:33 +02:00
|
|
|
// #include <board.h>
|
2015-04-11 01:44:37 +02:00
|
|
|
#include <toolchain.h>
|
|
|
|
#include <sections.h>
|
2015-05-28 19:56:47 +02:00
|
|
|
#include <arch/cpu.h>
|
2015-04-11 01:44:37 +02:00
|
|
|
|
2016-11-20 17:49:07 +01:00
|
|
|
GDATA(_interrupt_stack)
|
|
|
|
GDATA(_firq_stack)
|
2016-11-21 18:31:18 +01:00
|
|
|
GDATA(_main_stack)
|
2016-11-20 17:49:07 +01:00
|
|
|
|
|
|
|
/* use one of the available interrupt stacks during init */
|
|
|
|
|
|
|
|
/* FIRQ only ? */
|
|
|
|
#if CONFIG_NUM_IRQ_PRIO_LEVELS == 1
|
|
|
|
|
|
|
|
/* FIRQ, but uses _interrupt_stack ? */
|
|
|
|
#if CONFIG_RGF_NUM_BANKS == 1
|
|
|
|
#define INIT_STACK _interrupt_stack
|
|
|
|
#define INIT_STACK_SIZE CONFIG_ISR_STACK_SIZE
|
|
|
|
#else
|
|
|
|
#define INIT_STACK _firq_stack
|
|
|
|
#define INIT_STACK_SIZE CONFIG_FIRQ_STACK_SIZE
|
|
|
|
#endif
|
2016-05-15 01:00:25 +02:00
|
|
|
#else
|
2016-11-20 17:49:07 +01:00
|
|
|
#define INIT_STACK _interrupt_stack
|
|
|
|
#define INIT_STACK_SIZE CONFIG_ISR_STACK_SIZE
|
2016-05-15 01:00:25 +02:00
|
|
|
#endif
|
2015-04-11 01:44:37 +02:00
|
|
|
|
|
|
|
GTEXT(__reset)
|
arc: Set __start entry point to be same as __reset
There is a BUG here in that the alias for __start was
aliased to the start of the vector table. Yet, on ARC CPUs,
the vector table CANNOT be the entry point, because there
is no code in a vector table. Only addresses appear in each vector.
Thus, the reset vector, at offset 0 in this table, is a raw address.
The top Makefile in zephyr sets the lable __start to be the entry point
like this: -e __start. Debuggers, for example, use this entry point
to know where the first line of code is.
Also, in KConfig, there were duplicate NSIM blocks. One has been
removed.
Change-Id: I480be7d338a8b45b8ea6ef3f55ac2e6c43829452
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-05 02:46:27 +02:00
|
|
|
GTEXT(__start)
|
2015-04-11 01:44:37 +02:00
|
|
|
|
2015-07-01 23:22:39 +02:00
|
|
|
/**
|
|
|
|
*
|
2015-07-01 23:51:40 +02:00
|
|
|
* @brief Reset vector
|
2015-07-01 23:22:39 +02:00
|
|
|
*
|
|
|
|
* Ran when the system comes out of reset. The processor is at supervisor level.
|
|
|
|
*
|
|
|
|
* Locking interrupts prevents anything from interrupting the CPU.
|
|
|
|
*
|
|
|
|
* When these steps are completed, jump to _PrepC(), which will finish setting
|
|
|
|
* up the system for running C code.
|
|
|
|
*
|
2015-07-01 23:29:04 +02:00
|
|
|
* @return N/A
|
2015-07-01 23:22:39 +02:00
|
|
|
*/
|
2015-04-11 01:44:37 +02:00
|
|
|
|
|
|
|
SECTION_FUNC(TEXT,__reset)
|
arc: Set __start entry point to be same as __reset
There is a BUG here in that the alias for __start was
aliased to the start of the vector table. Yet, on ARC CPUs,
the vector table CANNOT be the entry point, because there
is no code in a vector table. Only addresses appear in each vector.
Thus, the reset vector, at offset 0 in this table, is a raw address.
The top Makefile in zephyr sets the lable __start to be the entry point
like this: -e __start. Debuggers, for example, use this entry point
to know where the first line of code is.
Also, in KConfig, there were duplicate NSIM blocks. One has been
removed.
Change-Id: I480be7d338a8b45b8ea6ef3f55ac2e6c43829452
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-05 02:46:27 +02:00
|
|
|
SECTION_FUNC(TEXT,__start)
|
2015-04-11 01:44:37 +02:00
|
|
|
|
|
|
|
/* lock interrupts: will get unlocked when switch to main task */
|
|
|
|
clri
|
|
|
|
|
2016-11-29 23:09:31 +01:00
|
|
|
mov r1, 1
|
|
|
|
|
|
|
|
invalidate_and_disable_icache:
|
|
|
|
|
|
|
|
lr r0, [_ARC_V2_I_CACHE_BUILD]
|
|
|
|
and.f r0, r0, 0xff
|
|
|
|
bz.nd invalidate_dcache
|
|
|
|
|
|
|
|
mov_s r2, 0
|
|
|
|
sr r2, [_ARC_V2_IC_IVIC]
|
|
|
|
/* writing to IC_IVIC needs 3 NOPs */
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
sr r1, [_ARC_V2_IC_CTRL]
|
|
|
|
|
|
|
|
invalidate_dcache:
|
|
|
|
|
|
|
|
lr r3, [_ARC_V2_D_CACHE_BUILD]
|
|
|
|
and.f r3, r3, 0xff
|
|
|
|
bz.nd done_cache_invalidate
|
|
|
|
|
|
|
|
sr r1, [_ARC_V2_DC_IVDC]
|
|
|
|
|
|
|
|
done_cache_invalidate:
|
|
|
|
|
2016-11-01 14:07:34 +01:00
|
|
|
#if defined(CONFIG_SYS_POWER_DEEP_SLEEP) && \
|
|
|
|
!defined(CONFIG_BOOTLOADER_CONTEXT_RESTORE)
|
|
|
|
jl @_sys_soc_resume_from_deep_sleep
|
|
|
|
#endif
|
|
|
|
|
2016-11-21 18:31:18 +01:00
|
|
|
#ifdef CONFIG_INIT_STACKS
|
|
|
|
/*
|
|
|
|
* use the main stack to call memset on the interrupt stack and the
|
|
|
|
* FIRQ stack when CONFIG_INIT_STACKS is enabled before switching to
|
|
|
|
* one of them for the rest of the early boot
|
|
|
|
*/
|
|
|
|
mov sp, _main_stack
|
|
|
|
add sp, sp, CONFIG_MAIN_STACK_SIZE
|
|
|
|
|
|
|
|
mov_s r0, _interrupt_stack
|
|
|
|
mov_s r1, 0xaa
|
|
|
|
mov_s r2, CONFIG_ISR_STACK_SIZE
|
|
|
|
jl memset
|
|
|
|
|
2016-11-24 16:04:05 +01:00
|
|
|
#if CONFIG_RGF_NUM_BANKS != 1
|
2016-11-21 18:31:18 +01:00
|
|
|
mov_s r0, _firq_stack
|
|
|
|
mov_s r1, 0xaa
|
|
|
|
mov_s r2, CONFIG_FIRQ_STACK_SIZE
|
|
|
|
jl memset
|
|
|
|
#endif
|
|
|
|
|
2016-11-24 16:04:05 +01:00
|
|
|
#endif /* CONFIG_INIT_STACKS */
|
|
|
|
|
2016-11-20 17:49:07 +01:00
|
|
|
mov sp, INIT_STACK
|
|
|
|
add sp, sp, INIT_STACK_SIZE
|
2015-04-11 01:44:37 +02:00
|
|
|
|
|
|
|
j @_PrepC
|