diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-17 06:33:51 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 09:49:35 +0200 |
commit | 5a06b187fb33b5b4a93ea2462f4af2121b29259d (patch) | |
tree | cb37d8753078e8a41b103fcc049eec2e17ab7814 /bsps/shared/start/bspgetworkarea-default.c | |
parent | 6d21a3f230baefd0134ac7c09fb02b303386e243 (diff) |
bsps: Move bspgetworkarea.c to bsps
This patch is a part of the BSP source reorganization.
Update #3285.
Diffstat (limited to 'bsps/shared/start/bspgetworkarea-default.c')
-rw-r--r-- | bsps/shared/start/bspgetworkarea-default.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/bsps/shared/start/bspgetworkarea-default.c b/bsps/shared/start/bspgetworkarea-default.c new file mode 100644 index 0000000000..302fc0f335 --- /dev/null +++ b/bsps/shared/start/bspgetworkarea-default.c @@ -0,0 +1,62 @@ +/** + * @file + * + * This routine is an implementation of the bsp_work_area_initialize() + * that can be used by all BSPs following linkcmds conventions + * regarding heap, stack, and workspace allocation. + */ + +/* + * COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * Copyright (c) 2011-2012 embedded brains GmbH. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <bsp.h> +#include <bsp/bootcard.h> +#ifdef BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN + #include <rtems/config.h> +#endif + +#if defined(HAS_UBOOT) && !defined(BSP_DISABLE_UBOOT_WORK_AREA_CONFIG) + #define USE_UBOOT +#endif + +/* + * These are provided by the linkcmds for ALL of the BSPs which use this file. + */ +extern char WorkAreaBase[]; + +/* + * We may get the size information from U-Boot or the linker scripts. + */ +#ifdef USE_UBOOT + #include <bsp/u-boot.h> +#else + extern char RamBase[]; + extern char RamSize[]; +#endif + +void bsp_work_area_initialize(void) +{ + uintptr_t work_base = (uintptr_t) WorkAreaBase; + uintptr_t ram_end; + + #ifdef USE_UBOOT + ram_end = (uintptr_t) bsp_uboot_board_info.bi_memstart + + bsp_uboot_board_info.bi_memsize; + #else + ram_end = (uintptr_t)RamBase + (uintptr_t)RamSize; + #endif + + #ifdef BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN + work_base += rtems_configuration_get_interrupt_stack_size(); + #endif + + bsp_work_area_initialize_default( (void *) work_base, ram_end - work_base ); +} |