aboutsummaryrefslogtreecommitdiff
path: root/arch/src/arm_mm.c
blob: 66144706ff2cf8e1cb2e6c101bce38cd07dfca19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Arm SCP/MCP Software
 * Copyright (c) 2015-2018, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 * Description:
 *     Memory initialization.
 */

#include <stdint.h>
#include <fwk_arch.h>
#include <fwk_assert.h>
#include <fwk_errno.h>
#include <fwk_macros.h>

int arm_mm_init(struct fwk_arch_mm_data *data)
{
    fwk_assert(data != NULL);

#ifdef __ARMCC_VERSION
    extern unsigned int Image$$ARM_LIB_STACKHEAP$$ZI$$Base;
    extern unsigned int Image$$ARM_LIB_STACKHEAP$$ZI$$Length;

    data->start = (uintptr_t)(&Image$$ARM_LIB_STACKHEAP$$ZI$$Base);
    data->size = (size_t)(&Image$$ARM_LIB_STACKHEAP$$ZI$$Length);
#else
    extern char __stackheap_start__;
    extern char __stackheap_end__;

    uintptr_t start = (uintptr_t)(&__stackheap_start__);
    uintptr_t end = (uintptr_t)(&__stackheap_end__);

    data->start = start;
    data->size = end - start;
#endif

    return FWK_SUCCESS;
}