Skip to content

Commit 25f9691

Browse files
committed
Closer to booting and running
1 parent 2fcb08c commit 25f9691

9 files changed

Lines changed: 116 additions & 167 deletions

File tree

ref_app/target.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,8 +1148,8 @@
11481148
<ClCompile Include="target\micros\xtensa_esp32_s3\startup\crt0_init_ram.cpp" />
11491149
<ClCompile Include="target\micros\xtensa_esp32_s3\startup\crt1.cpp" />
11501150
<ClCompile Include="target\micros\xtensa_esp32_s3\startup\Std\StdLib.cpp" />
1151-
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Appli\main.cpp" />
1152-
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Mcal\Mcu.cpp" />
1151+
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Appli\main.c" />
1152+
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Mcal\Mcu.c" />
11531153
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup\Startup.c" />
11541154
</ItemGroup>
11551155
<ItemGroup>

ref_app/target.vcxproj.filters

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,13 +1007,13 @@
10071007
<ClCompile Include="target\micros\xtensa_esp32_s3\startup\Std\StdLib.cpp">
10081008
<Filter>micros\xtensa_esp32_s3\startup\Std</Filter>
10091009
</ClCompile>
1010-
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Mcal\Mcu.cpp">
1011-
<Filter>micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Mcal</Filter>
1012-
</ClCompile>
10131010
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup\Startup.c">
10141011
<Filter>micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup</Filter>
10151012
</ClCompile>
1016-
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Appli\main.cpp">
1013+
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Mcal\Mcu.c">
1014+
<Filter>micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Mcal</Filter>
1015+
</ClCompile>
1016+
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Appli\main.c">
10171017
<Filter>micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Appli</Filter>
10181018
</ClCompile>
10191019
</ItemGroup>

ref_app/target/micros/xtensa_esp32_s3/startup/coprocessor_binary.S

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
.global coprocessor_bin
33
coprocessor_bin:
44
.byte 0x6F, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
5-
.byte 0x17, 0x11, 0x00, 0x00, 0x13, 0x01, 0x01, 0x42, 0x6F, 0x00, 0x40, 0x0C, 0xA9, 0x67, 0x83, 0xA6
5+
.byte 0x17, 0x11, 0x00, 0x00, 0x13, 0x01, 0x01, 0x42, 0x6F, 0x00, 0xC0, 0x06, 0xA9, 0x67, 0x83, 0xA6
66
.byte 0xC7, 0x4C, 0xB7, 0x05, 0x08, 0x00, 0x37, 0x06, 0x00, 0x10, 0xCD, 0x8E, 0x23, 0xA6, 0xD7, 0x4C
7-
.byte 0x23, 0xA8, 0x07, 0x46, 0x83, 0xA6, 0xC7, 0x40, 0x13, 0x87, 0x07, 0x40, 0xD1, 0x8E, 0x23, 0xA6
8-
.byte 0xD7, 0x40, 0x03, 0xA6, 0x87, 0x4C, 0x4D, 0x8E, 0x23, 0xA4, 0xC7, 0x4C, 0x23, 0xA6, 0x07, 0x46
9-
.byte 0x83, 0xA6, 0xC7, 0x40, 0x37, 0x06, 0x00, 0x18, 0xD1, 0x8E, 0x23, 0xA6, 0xD7, 0x40, 0x23, 0x20
10-
.byte 0x07, 0x00, 0xB7, 0x06, 0x00, 0x08, 0xB7, 0x07, 0x0C, 0x00, 0x01, 0x00, 0xFD, 0x17, 0xF5, 0xFF
11-
.byte 0x1C, 0x43, 0xB5, 0x8F, 0x1C, 0xC3, 0xC5, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x37, 0x07, 0x0C, 0x60
12-
.byte 0x9D, 0x46, 0xBA, 0x87, 0x14, 0xC7, 0x13, 0x07, 0x10, 0x40, 0xB8, 0xD3, 0x82, 0x80, 0x00, 0x00
13-
.byte 0xB7, 0x37, 0x1D, 0x8F, 0x37, 0x87, 0x00, 0x60, 0x93, 0x87, 0xA7, 0x12, 0x23, 0x2C, 0xF7, 0x0A
14-
.byte 0x23, 0x2E, 0x07, 0x08, 0xB7, 0x06, 0x00, 0x40, 0x23, 0x2A, 0xD7, 0x0A, 0xB7, 0x46, 0xD8, 0x50
15-
.byte 0x23, 0x2C, 0x07, 0x0A, 0xB7, 0xF7, 0x01, 0x60, 0x93, 0x86, 0x16, 0xAA, 0xF4, 0xD3, 0x23, 0xA4
16-
.byte 0x07, 0x04, 0x37, 0x47, 0x00, 0x60, 0x23, 0xA2, 0x07, 0x06, 0x23, 0x22, 0x07, 0x00, 0x23, 0x28
17-
.byte 0x07, 0x00, 0xFD, 0x56, 0x54, 0xD3, 0x14, 0xDB, 0x82, 0x80, 0x00, 0x00, 0x41, 0x11, 0x06, 0xC6
18-
.byte 0x22, 0xC4, 0x26, 0xC2, 0x75, 0x37, 0x59, 0x3F, 0xB7, 0x16, 0x00, 0x50, 0x83, 0xA7, 0x86, 0x00
19-
.byte 0x7D, 0x56, 0x93, 0x86, 0x86, 0x00, 0x63, 0x83, 0xC7, 0x02, 0xD8, 0x42, 0x63, 0x00, 0xC7, 0x02
20-
.byte 0x81, 0x47, 0x09, 0xCB, 0x98, 0x42, 0x3E, 0x97, 0x23, 0x00, 0x07, 0x00, 0xD8, 0x42, 0x85, 0x07
21-
.byte 0xE3, 0xEA, 0xE7, 0xFE, 0x9C, 0x46, 0xA1, 0x06, 0xE3, 0x91, 0xC7, 0xFE, 0xB7, 0x17, 0x00, 0x50
22-
.byte 0x83, 0xA7, 0x07, 0x00, 0x37, 0x14, 0x00, 0x50, 0xFD, 0x54, 0x13, 0x04, 0x44, 0x00, 0x63, 0x87
23-
.byte 0x97, 0x00, 0x82, 0x97, 0x1C, 0x40, 0x11, 0x04, 0xE3, 0x9D, 0x97, 0xFE, 0xC5, 0x35, 0x01, 0x00
24-
.byte 0x01, 0x00, 0xF5, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
7+
.byte 0x23, 0xA8, 0x07, 0x46, 0x83, 0xA6, 0xC7, 0x40, 0xD1, 0x8E, 0x23, 0xA6, 0xD7, 0x40, 0x03, 0xA6
8+
.byte 0x87, 0x4C, 0x93, 0x86, 0x07, 0x40, 0x4D, 0x8E, 0x23, 0xA4, 0xC7, 0x4C, 0x23, 0xA6, 0x07, 0x46
9+
.byte 0x03, 0xA7, 0xC7, 0x40, 0x37, 0x06, 0x00, 0x18, 0x51, 0x8F, 0x23, 0xA6, 0xE7, 0x40, 0x23, 0xA0
10+
.byte 0x06, 0x00, 0x37, 0x06, 0x00, 0x08, 0x98, 0x42, 0xB7, 0x07, 0x0C, 0x00, 0x31, 0x8F, 0x98, 0xC2
11+
.byte 0x01, 0x00, 0xFD, 0x17, 0xF5, 0xFF, 0xC5, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x82, 0x80, 0x00, 0x00
12+
.byte 0x82, 0x80, 0x00, 0x00, 0x41, 0x11, 0x06, 0xC6, 0x22, 0xC4, 0x26, 0xC2, 0xD5, 0x3F, 0xFD, 0x37
13+
.byte 0xB7, 0x16, 0x00, 0x50, 0x83, 0xA7, 0x86, 0x00, 0x7D, 0x56, 0x93, 0x86, 0x86, 0x00, 0x63, 0x83
14+
.byte 0xC7, 0x02, 0xD8, 0x42, 0x63, 0x00, 0xC7, 0x02, 0x81, 0x47, 0x09, 0xCB, 0x98, 0x42, 0x3E, 0x97
15+
.byte 0x23, 0x00, 0x07, 0x00, 0xD8, 0x42, 0x85, 0x07, 0xE3, 0xEA, 0xE7, 0xFE, 0x9C, 0x46, 0xA1, 0x06
16+
.byte 0xE3, 0x91, 0xC7, 0xFE, 0xB7, 0x17, 0x00, 0x50, 0x83, 0xA7, 0x07, 0x00, 0x37, 0x14, 0x00, 0x50
17+
.byte 0xFD, 0x54, 0x13, 0x04, 0x44, 0x00, 0x63, 0x87, 0x97, 0x00, 0x82, 0x97, 0x1C, 0x40, 0x11, 0x04
18+
.byte 0xE3, 0x9D, 0x97, 0xFE, 0x25, 0x3F, 0x01, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
19+
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20+
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
21+
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
22+
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
23+
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
24+
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2525
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2626
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2727
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/from_no_sdk/Code/Appli/main.cpp renamed to ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/from_no_sdk/Code/Appli/main.c

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
1-
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2025.
3-
// Distributed under the Boost Software License,
4-
// Version 1.0. (See accompanying file LICENSE_1_0.txt
5-
// or copy at http://www.boost.org/LICENSE_1_0.txt)
6-
//
7-
8-
// Originally from:
91
/******************************************************************************************
102
Filename : main.c
11-
3+
124
Core : RISC-V
13-
5+
146
MCU : ESP32-S3
15-
7+
168
Author : Chalandi Amine
17-
9+
1810
Owner : Chalandi Amine
19-
11+
2012
Date : 22.02.2025
21-
13+
2214
Description : Application main function for ULP-RISC-V Co-processor
23-
15+
2416
******************************************************************************************/
2517

2618
//=============================================================================
2719
// Includes
2820
//=============================================================================
29-
#include <cstdint>
21+
#include<stdint.h>
3022

3123
//=============================================================================
3224
// Prototypes
@@ -49,6 +41,7 @@
4941
//=============================================================================
5042
// Macros
5143
//=============================================================================
44+
#define TOGGLE_GPIO18() RTC_GPIO_OUT_REG ^= (1ul << (10 + 18))
5245
#define TOGGLE_GPIO17() RTC_GPIO_OUT_REG ^= (1ul << (10 + 17))
5346

5447

@@ -59,9 +52,8 @@
5952
///
6053
/// \return void
6154
//-----------------------------------------------------------------------------------------
62-
extern "C" int main() __attribute__((used, noinline));
55+
int main() __attribute__((used, noinline));
6356

64-
extern "C"
6557
int main()
6658
{
6759
/* configure GPIO17 and GPIO18 as output low */
@@ -75,11 +67,13 @@ int main()
7567

7668
for(;;)
7769
{
78-
for(uint32_t i = 0; i < 0xC0000; i++)
79-
{
80-
__asm("nop");
81-
}
70+
TOGGLE_GPIO17();
8271

83-
TOGGLE_GPIO17();
72+
for(uint32_t i=0; i< 0xC0000; ++i)
73+
{
74+
__asm("nop");
75+
}
8476
}
77+
78+
return 0;
8579
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/******************************************************************************************
2+
Filename : Mcu.c
3+
4+
Core : Xtensa LX7
5+
6+
MCU : ESP32-S3
7+
8+
Author : Chalandi Amine
9+
10+
Owner : Chalandi Amine
11+
12+
Date : 22.02.2025
13+
14+
Description : Mcu basic functions for ESP32-S3
15+
16+
******************************************************************************************/
17+
18+
//=============================================================================
19+
// Includes
20+
//=============================================================================
21+
22+
void Mcu_ClockInit(void);
23+
void Mcu_InitCore(void);
24+
25+
void Mcu_ClockInit(void) { }
26+
27+
void Mcu_InitCore(void) { }

ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/from_no_sdk/Code/Mcal/Mcu.cpp

Lines changed: 0 additions & 84 deletions
This file was deleted.

ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/from_no_sdk/Code/Startup/IntVectTable.S

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
/******************************************************************************************
2-
// Copyright Christopher Kormanyos 2025.
3-
// Distributed under the Boost Software License,
4-
// Version 1.0. (See accompanying file LICENSE_1_0.txt
5-
// or copy at http://www.boost.org/LICENSE_1_0.txt)
6-
//
7-
******************************************************************************************/
8-
9-
/* Originally from: */
101
/******************************************************************************************
112
Filename : IntVectTable.S
123

ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/from_no_sdk/Code/Startup/Startup.c

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2025.
3-
// Distributed under the Boost Software License,
4-
// Version 1.0. (See accompanying file LICENSE_1_0.txt
5-
// or copy at http://www.boost.org/LICENSE_1_0.txt)
6-
//
7-
81
// ***************************************************************************************
92
// Filename : Startup.c
103
//
@@ -64,7 +57,7 @@ static void Startup_InitCore(void);
6457
//=========================================================================================
6558
// extern function prototype
6659
//=========================================================================================
67-
extern int main(void);
60+
extern int main(void) __attribute__((used, noinline));
6861
extern void Mcu_ClockInit(void);
6962
extern void Mcu_InitCore(void);
7063

@@ -81,23 +74,20 @@ extern void Mcu_InitCore(void);
8174
//-----------------------------------------------------------------------------------------
8275
void Startup_Init(void)
8376
{
84-
Mcu_InitCore();
77+
/* Initialize the CPU Core */
78+
Startup_InitCore();
79+
80+
/* Configure the system clock */
81+
Startup_InitSystemClock();
8582

86-
Mcu_ClockInit();
8783
/* Initialize the RAM memory */
8884
Startup_InitRam();
8985

9086
/* Initialize the non-local C++ objects */
9187
Startup_InitCtors();
9288

9389
/* Start the application */
94-
95-
(void) main();
96-
97-
for(;;)
98-
{
99-
__asm("nop");
100-
}
90+
Startup_RunApplication();
10191
}
10292

10393

@@ -159,3 +149,43 @@ static void Startup_InitCtors(void)
159149
((void (*)(void))((__STARTUP_RUNTIME_CTORS)[CtorIdx++]))();
160150
}
161151
}
152+
153+
//-----------------------------------------------------------------------------------------
154+
/// \brief Startup_RunApplication function
155+
///
156+
/// \param void
157+
///
158+
/// \return void
159+
//-----------------------------------------------------------------------------------------
160+
static void Startup_RunApplication(void)
161+
{
162+
/* Check the weak function */
163+
(void)main();
164+
165+
/* Catch unexpected exit from main or if main does not exist */
166+
for(;;);
167+
}
168+
169+
//-----------------------------------------------------------------------------------------
170+
/// \brief Startup_InitSystemClock function
171+
///
172+
/// \param void
173+
///
174+
/// \return void
175+
//-----------------------------------------------------------------------------------------
176+
static void Startup_InitSystemClock(void)
177+
{
178+
Mcu_ClockInit();
179+
}
180+
181+
//-----------------------------------------------------------------------------------------
182+
/// \brief Startup_InitCore function
183+
///
184+
/// \param void
185+
///
186+
/// \return void
187+
//-----------------------------------------------------------------------------------------
188+
void Startup_InitCore(void)
189+
{
190+
Mcu_InitCore();
191+
}

ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/from_no_sdk/Code/Startup/boot.S

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
/******************************************************************************************
2-
// Copyright Christopher Kormanyos 2025.
3-
// Distributed under the Boost Software License,
4-
// Version 1.0. (See accompanying file LICENSE_1_0.txt
5-
// or copy at http://www.boost.org/LICENSE_1_0.txt)
6-
//
7-
******************************************************************************************/
8-
9-
/* Originally from: */
101
/******************************************************************************************
112
Filename : boot.S
123

0 commit comments

Comments
 (0)