Skip to content

Commit 65e5b8f

Browse files
committed
Do some trivial cleanup
1 parent b345212 commit 65e5b8f

10 files changed

Lines changed: 38 additions & 56 deletions

File tree

ref_app/src/sys/start/sys_start.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2007 - 2025.
2+
// Copyright Christopher Kormanyos 2007 - 2026.
33
// Distributed under the Boost Software License,
44
// Version 1.0. (See accompanying file LICENSE_1_0.txt
55
// or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -11,9 +11,9 @@
1111
#include <util/utility/util_attribute.h>
1212

1313
#if (defined(__XTENSA__) && !defined(CONFIG_IDF_TARGET_ESP32S3))
14-
extern "C" auto app_main_loop() -> int ATTRIBUTE(used);
14+
extern "C" auto app_main_loop() -> int ATTRIBUTE(used, noinline);
1515
#else
16-
ATTRIBUTE(used) auto main() -> int;
16+
ATTRIBUTE(used, noinline) auto main() -> int;
1717
#endif
1818

1919
#if (defined(__XTENSA__) && !defined(CONFIG_IDF_TARGET_ESP32S3))

ref_app/target/micros/am6254_soc/Code/Appli/Core/a53/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717

1818
extern uint32_t GetActiveCoreId(void);
1919

20-
extern int main(void) ATTRIBUTE(used);
20+
extern int main(void) ATTRIBUTE(used,noinline);
2121

2222
//extern void main_core0(void);
2323
extern void main_core1(void);
2424
extern void main_core2(void);
2525
extern void main_core3(void);
2626
extern void main_core0_init(void);
2727

28-
void timer_isr(void) ATTRIBUTE(used);
29-
void main_x(void) ATTRIBUTE(used);
30-
static void main_init(const uint32_t ActiveCore) ATTRIBUTE(used);
28+
void timer_isr(void) ATTRIBUTE(used,noinline);
29+
void main_x(void) ATTRIBUTE(used,noinline);
30+
static void main_init(const uint32_t ActiveCore) ATTRIBUTE(used,noinline);
3131

3232
void main_x(void)
3333
{

ref_app/target/micros/am6254_soc/Code/Startup/Core/a53/Startup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static void Startup_Unexpected_Exit(void);
6161
static void Startup_InitSystemClock(void);
6262
static void Startup_InitSystemPeripheral(void);
6363

64-
extern void main_x(void) ATTRIBUTE(used);
64+
extern void main_x(void) ATTRIBUTE(used,noinline);
6565

6666
void Startup_Init(void)
6767
{

ref_app/target/micros/xtensa_esp32_p4/make/xtensa_esp32_p4_flags.gmk

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,36 +50,24 @@ TGT_LDFLAGS = -nostdlib
5050
--specs=nosys.specs
5151

5252

53-
# ------------------------------------------------------------------------------
54-
# Rule to assemble source file (*.S) to object file (*.o).
55-
# ------------------------------------------------------------------------------
56-
57-
ifeq ($(TYP_OS),WIN)
58-
TGT_GCC := $(PATH_TOOLS_CC)/$(GCC_PREFIX)-gcc.exe
59-
TGT_GCC := $(subst /,\,$(TGT_GCC))
60-
else
61-
TGT_GCC := $(GCC_PREFIX)-gcc
62-
endif
63-
64-
6553
# ------------------------------------------------------------------------------
6654
# Image file and flash batch file.
6755
# ------------------------------------------------------------------------------
6856

69-
RULE_SPECIAL_MAKE_IMAGE_FILE :=
57+
RULE_SPECIAL_MAKE_IMAGE_FILE :=
7058

7159
ifeq ($(TYP_OS),WIN)
7260

7361
ESP32S3_ESP_TOOL_DIR := $(PATH_TOOLS)/espressif/esptool-v4.11.0-windows-amd64
7462

75-
ESP32S3_ESP_TOOL_FLAGS_PROG := --chip esp32p4 \
76-
-p COM5 -b 460800 \
77-
--before=default_reset \
78-
--after=hard_reset write_flash \
79-
--flash_mode dio \
80-
--flash_freq 80m \
81-
--flash_size 32MB \
82-
0x2000 $(CURDIR)/$(PATH_TGT)/startup/Code/SBL/Output/SBL.bin \
63+
ESP32S3_ESP_TOOL_FLAGS_PROG := --chip esp32p4 \
64+
-p COM5 -b 460800 \
65+
--before=default_reset \
66+
--after=hard_reset write_flash \
67+
--flash_mode dio \
68+
--flash_freq 80m \
69+
--flash_size 32MB \
70+
0x2000 $(CURDIR)/$(PATH_TGT)/startup/Code/SBL/Output/SBL.bin \
8371
0x5000 $(CURDIR)/$(basename $(APP).$(TGT_SUFFIX)).bin
8472

8573

ref_app/target/micros/xtensa_esp32_p4/startup/Code/Appli/main_cores.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
extern "C"
1717
{
1818
extern auto osGetActiveCore(void) -> std::uint32_t;
19+
extern auto main_caller(void) -> void;
1920

2021
auto main_core0() -> void;
2122
auto main_core1() -> void;
22-
auto main_caller() -> void;
2323
}
2424

2525
auto main(void) -> int __attribute__((used,noinline));

ref_app/target/micros/xtensa_esp32_p4/startup/Code/Startup/Startup.c

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ static void Startup_InitMcuSystem(void);
3636
// Extern function prototype
3737
//=========================================================================================
3838
extern int main_x(void) __attribute__((used,noinline));
39+
extern void crt_init_ram(void);
40+
extern void crt_init_ctors(void);
3941

4042
//-----------------------------------------------------------------------------------------
4143
/// \brief Startup_Init function
@@ -68,9 +70,7 @@ void Startup_Init(void)
6870
//-----------------------------------------------------------------------------------------
6971
static void Startup_InitRam(void)
7072
{
71-
// Use my own standard static RAM initialization.
72-
73-
extern void crt_init_ram(void);
73+
// Use the ref_app's standard static RAM initialization.
7474

7575
crt_init_ram();
7676
}
@@ -84,9 +84,7 @@ static void Startup_InitRam(void)
8484
//-----------------------------------------------------------------------------------------
8585
static void Startup_InitCtors(void)
8686
{
87-
// Use my own standard static constructor initialization.
88-
89-
extern void crt_init_ctors();
87+
// Use the ref_app's standard static constructor initialization.
9088

9189
crt_init_ctors();
9290
}
@@ -100,22 +98,18 @@ static void Startup_InitCtors(void)
10098
//-----------------------------------------------------------------------------------------
10199
static void Startup_RunApplication(void)
102100
{
103-
/* check the weak function */
104-
if((unsigned int) &main_x != 0)
105-
{
106-
#ifdef HP_CORES_SMP_MODE
107-
// note: RISC-V has no WFE/SEV instructions to synchronize SMP system
108-
// so I am using CLINT to synchronize both HP cores on ESP32-P4
109-
110-
// Notify core1 that the setup of the runtime environment is done
111-
// by setting the SW interrupt pending bit in CLINT on core1.
112-
113-
*(volatile uint32_t*)0x20010000 = 1;
114-
#endif
115-
116-
// Call the main function.
117-
main_x();
118-
}
101+
#if defined(HP_CORES_SMP_MODE)
102+
// note: RISC-V has no WFE/SEV instructions to synchronize SMP system
103+
// so I am using CLINT to synchronize both HP cores on ESP32-P4
104+
105+
// Notify core1 that the setup of the runtime environment is done
106+
// by setting the SW interrupt pending bit in CLINT on core1.
107+
108+
*(volatile uint32_t*)0x20010000 = 1;
109+
#endif
110+
111+
// Call the main function.
112+
main_x();
119113

120114
// Catch unexpected exit from main or if main does not exist.
121115
Startup_Unexpected_Exit();

ref_app/target/micros/xtensa_esp32_p4/startup/Code/Startup/intvect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
// Functions prototype
3434
//=====================================================================================================
3535
static void UndefinedHandler(void);
36-
static void UndefinedHandler(void){ for(;;); }
36+
static void UndefinedHandler(void){ for(;;) { ; } }
3737

3838
void Isr_SW_Interrupt (void) __attribute__((weak, alias("UndefinedHandler")));
3939
void Isr_ExtInt00 (void) __attribute__((weak, alias("UndefinedHandler")));

ref_app/target/micros/xtensa_esp32_p4/startup/crt0_init_ram.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2007 - 2022.
2+
// Copyright Christopher Kormanyos 2007 - 2026.
33
// Distributed under the Boost Software License,
44
// Version 1.0. (See accompanying file LICENSE_1_0.txt
55
// or copy at http://www.boost.org/LICENSE_1_0.txt)

ref_app/target/micros/xtensa_esp32_p4/startup/crt1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2007 - 2022.
2+
// Copyright Christopher Kormanyos 2007 - 2026.
33
// Distributed under the Boost Software License,
44
// Version 1.0. (See accompanying file LICENSE_1_0.txt
55
// or copy at http://www.boost.org/LICENSE_1_0.txt)

ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#include <array>
3333

34-
auto main() -> int ATTRIBUTE(used);
34+
auto main() -> int ATTRIBUTE(used,noinline);
3535

3636
namespace
3737
{

0 commit comments

Comments
 (0)