Skip to content

Commit 8c98a97

Browse files
Andrew Boieioannisg
Andrew Boie
authored andcommitted
arm: arch code naming cleanup
This patch re-namespaces global variables and functions that are used only within the arch/arm/ code to be prefixed with z_arm_. Some instances of CamelCase have been corrected. Signed-off-by: Andrew Boie <[email protected]>
1 parent 4bca0f3 commit 8c98a97

File tree

51 files changed

+332
-329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+332
-329
lines changed

arch/arm/core/cortex_m/fault.c

+42-41
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ LOG_MODULE_DECLARE(os);
137137
*/
138138

139139
#if (CONFIG_FAULT_DUMP == 1)
140-
static void FaultShow(const z_arch_esf_t *esf, int fault)
140+
static void fault_show(const z_arch_esf_t *esf, int fault)
141141
{
142142
PR_EXC("Fault! EXC #%d", fault);
143143

@@ -156,7 +156,7 @@ static void FaultShow(const z_arch_esf_t *esf, int fault)
156156
*
157157
* For Dump level 0, no information needs to be generated.
158158
*/
159-
static void FaultShow(const z_arch_esf_t *esf, int fault)
159+
static void fault_show(const z_arch_esf_t *esf, int fault)
160160
{
161161
(void)esf;
162162
(void)fault;
@@ -205,13 +205,14 @@ u32_t z_check_thread_stack_fail(const u32_t fault_addr,
205205

206206
/**
207207
*
208-
* @brief Dump MPU fault information
208+
* @brief Dump MemManage fault information
209209
*
210-
* See _FaultDump() for example.
210+
* See z_arm_fault_dump() for example.
211211
*
212212
* @return error code to identify the fatal error reason
213213
*/
214-
static u32_t MpuFault(z_arch_esf_t *esf, int fromHardFault, bool *recoverable)
214+
static u32_t mem_manage_fault(z_arch_esf_t *esf, int from_hard_fault,
215+
bool *recoverable)
215216
{
216217
u32_t reason = K_ERR_CPU_EXCEPTION;
217218
u32_t mmfar = -EINVAL;
@@ -239,7 +240,7 @@ static u32_t MpuFault(z_arch_esf_t *esf, int fromHardFault, bool *recoverable)
239240

240241
if ((SCB->CFSR & SCB_CFSR_MMARVALID_Msk) != 0) {
241242
PR_EXC(" MMFAR Address: 0x%x", mmfar);
242-
if (fromHardFault) {
243+
if (from_hard_fault) {
243244
/* clear SCB_MMAR[VALID] to reset */
244245
SCB->CFSR &= ~SCB_CFSR_MMARVALID_Msk;
245246
}
@@ -328,13 +329,13 @@ static u32_t MpuFault(z_arch_esf_t *esf, int fromHardFault, bool *recoverable)
328329

329330
/**
330331
*
331-
* @brief Dump bus fault information
332+
* @brief Dump BusFault information
332333
*
333-
* See _FaultDump() for example.
334+
* See z_arm_fault_dump() for example.
334335
*
335336
* @return N/A
336337
*/
337-
static int BusFault(z_arch_esf_t *esf, int fromHardFault, bool *recoverable)
338+
static int bus_fault(z_arch_esf_t *esf, int from_hard_fault, bool *recoverable)
338339
{
339340
u32_t reason = K_ERR_CPU_EXCEPTION;
340341

@@ -360,7 +361,7 @@ static int BusFault(z_arch_esf_t *esf, int fromHardFault, bool *recoverable)
360361

361362
if ((SCB->CFSR & SCB_CFSR_BFARVALID_Msk) != 0) {
362363
PR_EXC(" BFAR Address: 0x%x", bfar);
363-
if (fromHardFault) {
364+
if (from_hard_fault) {
364365
/* clear SCB_CFSR_BFAR[VALID] to reset */
365366
SCB->CFSR &= ~SCB_CFSR_BFARVALID_Msk;
366367
}
@@ -482,13 +483,13 @@ static int BusFault(z_arch_esf_t *esf, int fromHardFault, bool *recoverable)
482483

483484
/**
484485
*
485-
* @brief Dump usage fault information
486+
* @brief Dump UsageFault information
486487
*
487-
* See _FaultDump() for example.
488+
* See z_arm_fault_dump() for example.
488489
*
489490
* @return error code to identify the fatal error reason
490491
*/
491-
static u32_t UsageFault(const z_arch_esf_t *esf)
492+
static u32_t usage_fault(const z_arch_esf_t *esf)
492493
{
493494
u32_t reason = K_ERR_CPU_EXCEPTION;
494495

@@ -538,13 +539,13 @@ static u32_t UsageFault(const z_arch_esf_t *esf)
538539
#if defined(CONFIG_ARM_SECURE_FIRMWARE)
539540
/**
540541
*
541-
* @brief Dump secure fault information
542+
* @brief Dump SecureFault information
542543
*
543-
* See _FaultDump() for example.
544+
* See z_arm_fault_dump() for example.
544545
*
545546
* @return N/A
546547
*/
547-
static void SecureFault(const z_arch_esf_t *esf)
548+
static void secure_fault(const z_arch_esf_t *esf)
548549
{
549550
PR_FAULT_INFO("***** SECURE FAULT *****");
550551

@@ -579,11 +580,11 @@ static void SecureFault(const z_arch_esf_t *esf)
579580
*
580581
* @brief Dump debug monitor exception information
581582
*
582-
* See _FaultDump() for example.
583+
* See z_arm_fault_dump() for example.
583584
*
584585
* @return N/A
585586
*/
586-
static void DebugMonitor(const z_arch_esf_t *esf)
587+
static void debug_monitor(const z_arch_esf_t *esf)
587588
{
588589
ARG_UNUSED(esf);
589590

@@ -599,11 +600,11 @@ static void DebugMonitor(const z_arch_esf_t *esf)
599600
*
600601
* @brief Dump hard fault information
601602
*
602-
* See _FaultDump() for example.
603+
* See z_arm_fault_dump() for example.
603604
*
604605
* @return error code to identify the fatal error reason
605606
*/
606-
static u32_t HardFault(z_arch_esf_t *esf, bool *recoverable)
607+
static u32_t hard_fault(z_arch_esf_t *esf, bool *recoverable)
607608
{
608609
u32_t reason = K_ERR_CPU_EXCEPTION;
609610

@@ -643,14 +644,14 @@ static u32_t HardFault(z_arch_esf_t *esf, bool *recoverable)
643644
} else if ((SCB->HFSR & SCB_HFSR_FORCED_Msk) != 0) {
644645
PR_EXC(" Fault escalation (see below)");
645646
if (SCB_MMFSR != 0) {
646-
reason = MpuFault(esf, 1, recoverable);
647+
reason = mem_manage_fault(esf, 1, recoverable);
647648
} else if (SCB_BFSR != 0) {
648-
reason = BusFault(esf, 1, recoverable);
649+
reason = bus_fault(esf, 1, recoverable);
649650
} else if (SCB_UFSR != 0) {
650-
reason = UsageFault(esf);
651+
reason = usage_fault(esf);
651652
#if defined(CONFIG_ARM_SECURE_FIRMWARE)
652653
} else if (SAU->SFSR != 0) {
653-
SecureFault(esf);
654+
secure_fault(esf);
654655
#endif /* CONFIG_ARM_SECURE_FIRMWARE */
655656
}
656657
}
@@ -665,11 +666,11 @@ static u32_t HardFault(z_arch_esf_t *esf, bool *recoverable)
665666
*
666667
* @brief Dump reserved exception information
667668
*
668-
* See _FaultDump() for example.
669+
* See z_arm_fault_dump() for example.
669670
*
670671
* @return N/A
671672
*/
672-
static void ReservedException(const z_arch_esf_t *esf, int fault)
673+
static void reserved_exception(const z_arch_esf_t *esf, int fault)
673674
{
674675
ARG_UNUSED(esf);
675676

@@ -679,47 +680,47 @@ static void ReservedException(const z_arch_esf_t *esf, int fault)
679680
}
680681

681682
/* Handler function for ARM fault conditions. */
682-
static u32_t FaultHandle(z_arch_esf_t *esf, int fault, bool *recoverable)
683+
static u32_t fault_handle(z_arch_esf_t *esf, int fault, bool *recoverable)
683684
{
684685
u32_t reason = K_ERR_CPU_EXCEPTION;
685686

686687
*recoverable = false;
687688

688689
switch (fault) {
689690
case 3:
690-
reason = HardFault(esf, recoverable);
691+
reason = hard_fault(esf, recoverable);
691692
break;
692693
#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE)
693-
/* HardFault is used for all fault conditions on ARMv6-M. */
694+
/* HardFault is raised for all fault conditions on ARMv6-M. */
694695
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
695696
case 4:
696-
reason = MpuFault(esf, 0, recoverable);
697+
reason = mem_manage_fault(esf, 0, recoverable);
697698
break;
698699
case 5:
699-
reason = BusFault(esf, 0, recoverable);
700+
reason = bus_fault(esf, 0, recoverable);
700701
break;
701702
case 6:
702-
reason = UsageFault(esf);
703+
reason = usage_fault(esf);
703704
break;
704705
#if defined(CONFIG_ARM_SECURE_FIRMWARE)
705706
case 7:
706-
SecureFault(esf);
707+
secure_fault(esf);
707708
break;
708709
#endif /* CONFIG_ARM_SECURE_FIRMWARE */
709710
case 12:
710-
DebugMonitor(esf);
711+
debug_monitor(esf);
711712
break;
712713
#else
713714
#error Unknown ARM architecture
714715
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
715716
default:
716-
ReservedException(esf, fault);
717+
reserved_exception(esf, fault);
717718
break;
718719
}
719720

720721
if ((*recoverable) == false) {
721722
/* Dump generic information about the fault. */
722-
FaultShow(esf, fault);
723+
fault_show(esf, fault);
723724
}
724725

725726
return reason;
@@ -733,7 +734,7 @@ static u32_t FaultHandle(z_arch_esf_t *esf, int fault, bool *recoverable)
733734
*
734735
* @param secure_esf Pointer to the secure stack frame.
735736
*/
736-
static void SecureStackDump(const z_arch_esf_t *secure_esf)
737+
static void secure_stack_dump(const z_arch_esf_t *secure_esf)
737738
{
738739
/*
739740
* In case a Non-Secure exception interrupted the Secure
@@ -769,7 +770,7 @@ static void SecureStackDump(const z_arch_esf_t *secure_esf)
769770
PR_FAULT_INFO(" S instruction address: 0x%x", sec_ret_addr);
770771

771772
}
772-
#define SECURE_STACK_DUMP(esf) SecureStackDump(esf)
773+
#define SECURE_STACK_DUMP(esf) secure_stack_dump(esf)
773774
#else
774775
/* We do not dump the Secure stack information for lower dump levels. */
775776
#define SECURE_STACK_DUMP(esf)
@@ -805,7 +806,7 @@ static void SecureStackDump(const z_arch_esf_t *secure_esf)
805806
* Note: exc_return argument shall only be used by the Fault handler if we are
806807
* running a Secure Firmware.
807808
*/
808-
void _Fault(z_arch_esf_t *esf, u32_t exc_return)
809+
void z_arm_fault(z_arch_esf_t *esf, u32_t exc_return)
809810
{
810811
u32_t reason = K_ERR_CPU_EXCEPTION;
811812
int fault = SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk;
@@ -880,7 +881,7 @@ void _Fault(z_arch_esf_t *esf, u32_t exc_return)
880881
(void) exc_return;
881882
#endif /* CONFIG_ARM_SECURE_FIRMWARE */
882883

883-
reason = FaultHandle(esf, fault, &recoverable);
884+
reason = fault_handle(esf, fault, &recoverable);
884885
if (recoverable) {
885886
return;
886887
}
@@ -900,7 +901,7 @@ void _Fault(z_arch_esf_t *esf, u32_t exc_return)
900901
*
901902
* @return N/A
902903
*/
903-
void z_FaultInit(void)
904+
void z_arm_fault_init(void)
904905
{
905906
#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE)
906907
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)

arch/arm/core/cortex_m/irq_init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @return N/A
2525
*/
2626

27-
void z_IntLibInit(void)
27+
void z_arm_int_lib_init(void)
2828
{
2929
int irq = 0;
3030

arch/arm/core/cortex_m/mpu/arm_core_mpu.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ LOG_MODULE_REGISTER(mpu);
2323
* available MPU regions for dynamic programming depends on the number of the
2424
* static MPU regions currently being programmed, and the total number of HW-
2525
* available MPU regions. This macro is only used internally in function
26-
* z_arch_configure_dynamic_mpu_regions(), to reserve sufficient area for the
26+
* z_arm_configure_dynamic_mpu_regions(), to reserve sufficient area for the
2727
* array of dynamic regions passed to the underlying driver.
2828
*/
2929
#if defined(CONFIG_USERSPACE)
@@ -59,7 +59,7 @@ LOG_MODULE_REGISTER(mpu);
5959
* For some MPU architectures, such as the unmodified ARMv8-M MPU,
6060
* the function must execute with MPU enabled.
6161
*/
62-
void z_arch_configure_static_mpu_regions(void)
62+
void z_arm_configure_static_mpu_regions(void)
6363
{
6464
#if defined(CONFIG_COVERAGE_GCOV) && defined(CONFIG_USERSPACE)
6565
const struct k_mem_partition gcov_region =
@@ -142,7 +142,7 @@ void z_arch_configure_static_mpu_regions(void)
142142
* For some MPU architectures, such as the unmodified ARMv8-M MPU,
143143
* the function must execute with MPU enabled.
144144
*/
145-
void z_arch_configure_dynamic_mpu_regions(struct k_thread *thread)
145+
void z_arm_configure_dynamic_mpu_regions(struct k_thread *thread)
146146
{
147147
/* Define an array of k_mem_partition objects to hold the configuration
148148
* of the respective dynamic MPU regions to be programmed for
@@ -293,7 +293,7 @@ void z_arch_mem_domain_thread_add(struct k_thread *thread)
293293
* This triggers re-programming of the entire dynamic
294294
* memory map.
295295
*/
296-
z_arch_configure_dynamic_mpu_regions(thread);
296+
z_arm_configure_dynamic_mpu_regions(thread);
297297
}
298298

299299
/*

arch/arm/core/cortex_m/reset.S

+10-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
_ASM_FILE_PROLOGUE
2020

21-
GTEXT(__reset)
21+
GTEXT(z_arm_reset)
2222
GTEXT(memset)
2323
GDATA(_interrupt_stack)
2424
#if defined(CONFIG_PLATFORM_SPECIFIC_INIT)
@@ -39,19 +39,19 @@ GTEXT(z_platform_init)
3939
* deep trouble.
4040
*
4141
* We want to use the process stack pointer (PSP) instead of the MSP, since the
42-
* MSP is to be set up to point to the one-and-only interrupt stack during later
43-
* boot. That would not be possible if in use for running C code.
42+
* MSP is to be set up to point to the one-and-only interrupt stack during
43+
* later boot. That would not be possible if in use for running C code.
4444
*
45-
* When these steps are completed, jump to _PrepC(), which will finish setting
46-
* up the system for running C code.
45+
* When these steps are completed, jump to z_arm_prep_c(), which will finish
46+
* setting up the system for running C code.
4747
*
4848
* @return N/A
4949
*/
5050

51-
SECTION_SUBSEC_FUNC(TEXT,_reset_section,__reset)
51+
SECTION_SUBSEC_FUNC(TEXT,_reset_section,z_arm_reset)
5252

5353
/*
54-
* The entry point is located at the __reset symbol, which
54+
* The entry point is located at the z_arm_reset symbol, which
5555
* is fetched by a XIP image playing the role of a bootloader, which jumps to
5656
* it, not through the reset vector mechanism. Such bootloaders might want to
5757
* search for a __start symbol instead, so create that alias here.
@@ -74,7 +74,7 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start)
7474

7575
#ifdef CONFIG_WDOG_INIT
7676
/* board-specific watchdog initialization is necessary */
77-
bl _WdogInit
77+
bl z_arm_watchdog_init
7878
#endif
7979

8080
#ifdef CONFIG_INIT_STACKS
@@ -105,7 +105,7 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start)
105105

106106
/*
107107
* 'bl' jumps the furthest of the branch instructions that are
108-
* supported on all platforms. So it is used when jumping to _PrepC
108+
* supported on all platforms. So it is used when jumping to z_arm_prep_c
109109
* (even though we do not intend to return).
110110
*/
111-
bl _PrepC
111+
bl z_arm_prep_c

0 commit comments

Comments
 (0)