Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ref_app/src/sys/start/sys_start.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2007 - 2025.
// Copyright Christopher Kormanyos 2007 - 2026.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -11,9 +11,9 @@
#include <util/utility/util_attribute.h>

#if (defined(__XTENSA__) && !defined(CONFIG_IDF_TARGET_ESP32S3))
extern "C" auto app_main_loop() -> int ATTRIBUTE(used);
extern "C" auto app_main_loop() -> int ATTRIBUTE(used, noinline);
#else
ATTRIBUTE(used) auto main() -> int;
ATTRIBUTE(used, noinline) auto main() -> int;
#endif

#if (defined(__XTENSA__) && !defined(CONFIG_IDF_TARGET_ESP32S3))
Expand Down
8 changes: 4 additions & 4 deletions ref_app/target/micros/am6254_soc/Code/Appli/Core/a53/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@

extern uint32_t GetActiveCoreId(void);

extern int main(void) ATTRIBUTE(used);
extern int main(void) ATTRIBUTE(used,noinline);

//extern void main_core0(void);
extern void main_core1(void);
extern void main_core2(void);
extern void main_core3(void);
extern void main_core0_init(void);

void timer_isr(void) ATTRIBUTE(used);
void main_x(void) ATTRIBUTE(used);
static void main_init(const uint32_t ActiveCore) ATTRIBUTE(used);
void timer_isr(void) ATTRIBUTE(used,noinline);
void main_x(void) ATTRIBUTE(used,noinline);
static void main_init(const uint32_t ActiveCore) ATTRIBUTE(used,noinline);

void main_x(void)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void Startup_Unexpected_Exit(void);
static void Startup_InitSystemClock(void);
static void Startup_InitSystemPeripheral(void);

extern void main_x(void) ATTRIBUTE(used);
extern void main_x(void) ATTRIBUTE(used,noinline);

void Startup_Init(void)
{
Expand Down
18 changes: 15 additions & 3 deletions ref_app/target/micros/xtensa_esp32_p4/make/xtensa_esp32_p4.ld
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ INPUT(libc.a libm.a libgcc.a)
/******************************************************************************************
Globals
******************************************************************************************/
__STACK_SIZE_CORE0 = 1K;
__STACK_SIZE_CORE1 = 1K;
__STACK_SIZE_CORE0 = 4K;
__STACK_SIZE_CORE1 = 4K;

/******************************************************************************************
Memory configuration
Expand Down Expand Up @@ -122,9 +122,15 @@ SECTIONS
*(.data*)
. = ALIGN(4);
KEEP (*(.data*))
*(.sdata)
. = ALIGN(4);
KEEP (*(.sdata))
*(.sdata*)
. = ALIGN(4);
KEEP (*(.sdata*))
_data_end = .;
} > RAM AT>FLASH

/* The uninitialized (zero-cleared) data sections */
.bss : ALIGN(4)
{
Expand All @@ -135,6 +141,12 @@ SECTIONS
*(.bss*)
. = ALIGN(4);
KEEP (*(.bss*))
*(.sbss)
. = ALIGN(4);
KEEP (*(.sbss))
*(.sbss*)
. = ALIGN(4);
KEEP (*(.sbss*))
_bss_end = .;
} > RAM

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ WARN_FLAGS :=
TGT_ALLFLAGS = -O2 \
-march=rv32imafc_zicsr_zifencei_xesppie \
-mabi=ilp32f \
-msmall-data-limit=0 \
-msmall-data-limit=32 \
-falign-functions=4 \
-fomit-frame-pointer \
-fno-reorder-blocks-and-partition \
-fno-reorder-functions \
-DHP_CORES_SMP_MODE

TGT_CFLAGS = -std=c23 \
Expand All @@ -50,36 +48,24 @@ TGT_LDFLAGS = -nostdlib
--specs=nosys.specs


# ------------------------------------------------------------------------------
# Rule to assemble source file (*.S) to object file (*.o).
# ------------------------------------------------------------------------------

ifeq ($(TYP_OS),WIN)
TGT_GCC := $(PATH_TOOLS_CC)/$(GCC_PREFIX)-gcc.exe
TGT_GCC := $(subst /,\,$(TGT_GCC))
else
TGT_GCC := $(GCC_PREFIX)-gcc
endif


# ------------------------------------------------------------------------------
# Image file and flash batch file.
# ------------------------------------------------------------------------------

RULE_SPECIAL_MAKE_IMAGE_FILE :=
RULE_SPECIAL_MAKE_IMAGE_FILE :=

ifeq ($(TYP_OS),WIN)

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

ESP32S3_ESP_TOOL_FLAGS_PROG := --chip esp32p4 \
-p COM5 -b 460800 \
--before=default_reset \
--after=hard_reset write_flash \
--flash_mode dio \
--flash_freq 80m \
--flash_size 32MB \
0x2000 $(CURDIR)/$(PATH_TGT)/startup/Code/SBL/Output/SBL.bin \
ESP32S3_ESP_TOOL_FLAGS_PROG := --chip esp32p4 \
-p COM5 -b 460800 \
--before=default_reset \
--after=hard_reset write_flash \
--flash_mode dio \
--flash_freq 80m \
--flash_size 32MB \
0x2000 $(CURDIR)/$(PATH_TGT)/startup/Code/SBL/Output/SBL.bin \
0x5000 $(CURDIR)/$(basename $(APP).$(TGT_SUFFIX)).bin


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
extern "C"
{
extern auto osGetActiveCore(void) -> std::uint32_t;
extern auto main_caller(void) -> void;

auto main_core0() -> void;
auto main_core1() -> void;
auto main_caller() -> void;
}

auto main(void) -> int __attribute__((used,noinline));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ static void Startup_InitMcuSystem(void);
// Extern function prototype
//=========================================================================================
extern int main_x(void) __attribute__((used,noinline));
extern void crt_init_ram(void);
extern void crt_init_ctors(void);

//-----------------------------------------------------------------------------------------
/// \brief Startup_Init function
Expand Down Expand Up @@ -68,9 +70,7 @@ void Startup_Init(void)
//-----------------------------------------------------------------------------------------
static void Startup_InitRam(void)
{
// Use my own standard static RAM initialization.

extern void crt_init_ram(void);
// Use the ref_app's standard static RAM initialization.

crt_init_ram();
}
Expand All @@ -84,9 +84,7 @@ static void Startup_InitRam(void)
//-----------------------------------------------------------------------------------------
static void Startup_InitCtors(void)
{
// Use my own standard static constructor initialization.

extern void crt_init_ctors();
// Use the ref_app's standard static constructor initialization.

crt_init_ctors();
}
Expand All @@ -100,22 +98,18 @@ static void Startup_InitCtors(void)
//-----------------------------------------------------------------------------------------
static void Startup_RunApplication(void)
{
/* check the weak function */
if((unsigned int) &main_x != 0)
{
#ifdef HP_CORES_SMP_MODE
// note: RISC-V has no WFE/SEV instructions to synchronize SMP system
// so I am using CLINT to synchronize both HP cores on ESP32-P4

// Notify core1 that the setup of the runtime environment is done
// by setting the SW interrupt pending bit in CLINT on core1.

*(volatile uint32_t*)0x20010000 = 1;
#endif

// Call the main function.
main_x();
}
#if defined(HP_CORES_SMP_MODE)
// note: RISC-V has no WFE/SEV instructions to synchronize SMP system
// so I am using CLINT to synchronize both HP cores on ESP32-P4

// Notify core1 that the setup of the runtime environment is done
// by setting the SW interrupt pending bit in CLINT on core1.

*(volatile uint32_t*)0x20010000 = 1;
#endif

// Call the main function.
main_x();

// Catch unexpected exit from main or if main does not exist.
Startup_Unexpected_Exit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// Functions prototype
//=====================================================================================================
static void UndefinedHandler(void);
static void UndefinedHandler(void){ for(;;); }
static void UndefinedHandler(void){ for(;;) { ; } }

void Isr_SW_Interrupt (void) __attribute__((weak, alias("UndefinedHandler")));
void Isr_ExtInt00 (void) __attribute__((weak, alias("UndefinedHandler")));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2007 - 2022.
// Copyright Christopher Kormanyos 2007 - 2026.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down
2 changes: 1 addition & 1 deletion ref_app/target/micros/xtensa_esp32_p4/startup/crt1.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2007 - 2022.
// Copyright Christopher Kormanyos 2007 - 2026.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#include <array>

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

namespace
{
Expand Down
Loading