mirror of
https://fuchsia.googlesource.com/third_party/pigweed.googlesource.com/pigweed/pigweed
synced 2024-09-21 14:16:26 +00:00
fff82ec721
Adds a new hook before static memory initialization occurs, namely initialization of .bss and .data, which is frequently used for things like enabling other memory regions with .data and/or .bss sections. The FPU enabling for targets/stm32f429i-disc1/early_boot.c was moved to pw_boot_PreStaticMemoryInit(), as this is may be needed for other pre static memory initialization tasks. In addition, the existing pw_boot_armv7m module is updated to follow the new naming style guide to prefix globals with "pw_boot_*". And lastly, the documentation is extended slightly to further explain what each hook is typically used for. Change-Id: Ic85e960a476c906b5fe781b87bb4cedd06982e60 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/16562 Reviewed-by: Armando Montanez <amontanez@google.com> Reviewed-by: Keir Mierle <keir@google.com> Commit-Queue: Ewout van Bekkum <ewout@google.com>
41 lines
1.4 KiB
C
41 lines
1.4 KiB
C
// Copyright 2020 The Pigweed Authors
|
|
//
|
|
// 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
|
|
//
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// 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.
|
|
|
|
#include "pw_boot_armv7m/boot.h"
|
|
#include "pw_malloc/malloc.h"
|
|
#include "pw_sys_io_baremetal_stm32f429/init.h"
|
|
|
|
void pw_boot_PreStaticMemoryInit() {
|
|
// TODO(pwbug/17): Optionally enable Replace when Pigweed config system is
|
|
// added.
|
|
#if PW_ARMV7M_ENABLE_FPU
|
|
// Enable FPU if built using hardware FPU instructions.
|
|
// CPCAR mask that enables FPU. (ARMv7-M Section B3.2.20)
|
|
const uint32_t kFpuEnableMask = (0xFu << 20);
|
|
|
|
// Memory mapped register to enable FPU. (ARMv7-M Section B3.2.2, Table B3-4)
|
|
volatile uint32_t* arm_v7m_cpacr = (volatile uint32_t*)0xE000ED88u;
|
|
|
|
*arm_v7m_cpacr |= kFpuEnableMask;
|
|
#endif // PW_ARMV7M_ENABLE_FPU
|
|
}
|
|
|
|
void pw_boot_PreStaticConstructorInit() {
|
|
#if PW_MALLOC_ACTIVE
|
|
pw_MallocInit();
|
|
#endif // PW_MALLOC_ACTIVE
|
|
}
|
|
|
|
void pw_boot_PreMainInit() { pw_sys_io_Init(); }
|