2016-04-29 05:30:07 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-04-29 05:30:07 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Full C support initialization
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Initialization of full C support: zero the .bss, copy the .data if XIP,
|
|
|
|
* call _Cstart().
|
|
|
|
*
|
|
|
|
* Stack is available in this module, but not the global data/bss until their
|
|
|
|
* initialization is performed.
|
|
|
|
*/
|
|
|
|
|
Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t. This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.
We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.
We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.
Jira: ZEP-2051
Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-19 23:32:08 +08:00
|
|
|
#include <zephyr/types.h>
|
2016-04-29 05:30:07 +08:00
|
|
|
#include <toolchain.h>
|
|
|
|
#include <linker-defs.h>
|
2016-11-08 23:36:50 +08:00
|
|
|
#include <kernel_structs.h>
|
2016-07-07 02:06:24 +08:00
|
|
|
#include <nano_internal.h>
|
2016-04-29 05:30:07 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
2016-07-07 02:06:24 +08:00
|
|
|
* @brief Prepare to and run C code
|
2016-04-29 05:30:07 +08:00
|
|
|
*
|
2016-07-07 02:06:24 +08:00
|
|
|
* This routine prepares for the execution of and runs C code.
|
2016-04-29 05:30:07 +08:00
|
|
|
*
|
|
|
|
* @return N/A
|
|
|
|
*/
|
|
|
|
|
2016-07-07 02:06:24 +08:00
|
|
|
void _PrepC(void)
|
2016-04-29 05:30:07 +08:00
|
|
|
{
|
2016-07-07 02:06:24 +08:00
|
|
|
_bss_zero();
|
2016-04-29 05:30:07 +08:00
|
|
|
#ifdef CONFIG_XIP
|
2016-07-07 02:06:24 +08:00
|
|
|
_data_copy();
|
2016-06-30 02:29:51 +08:00
|
|
|
/* In most XIP scenarios we copy the exception code into RAM, so need
|
|
|
|
* to flush instruction cache.
|
|
|
|
*/
|
|
|
|
_nios2_icache_flush_all();
|
2016-07-12 03:42:02 +08:00
|
|
|
#if ALT_CPU_ICACHE_SIZE > 0
|
2016-06-30 02:29:51 +08:00
|
|
|
/* Only need to flush the data cache here if there actually is an
|
|
|
|
* instruction cache, so that the cached instruction data written is
|
|
|
|
* actually committed.
|
|
|
|
*/
|
|
|
|
_nios2_dcache_flush_all();
|
|
|
|
#endif
|
2016-04-29 05:30:07 +08:00
|
|
|
#endif
|
|
|
|
_Cstart();
|
|
|
|
CODE_UNREACHABLE;
|
|
|
|
}
|