Skip to content

Commit 489c4b6

Browse files
committed
Get near-standard form esp32s3 riscv cop
1 parent ffb5997 commit 489c4b6

13 files changed

Lines changed: 248 additions & 263 deletions

File tree

ref_app/src/mcal/xtensa_esp32_s3_riscv_cop/mcal_led.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
//
77

88
#include <mcal_led.h>
9-
#include <mcal_led/mcal_led_dummy.h>
9+
#include <mcal_led/mcal_led_port.h>
1010

1111
mcal::led::led_base& mcal::led::led0()
1212
{
13-
using led0_led_type = mcal::led::led_dummy;
13+
using led0_port_type = mcal::port::port_pin<UINT32_C(17)>;
14+
15+
using led0_led_type = mcal::led::led_port<led0_port_type>;
1416

1517
static led0_led_type the_led_00;
1618

ref_app/src/mcal/xtensa_esp32_s3_riscv_cop/mcal_port.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include <mcal_port.h>
99

10-
void mcal::port::init(const config_type*)
10+
auto mcal::port::init(const config_type*) -> void
1111
{
12+
// Set all GPIO out registers to low.
13+
mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::rtc_gpio_out_reg, UINT32_C(0)>::reg_set();
1214
}

ref_app/src/mcal/xtensa_esp32_s3_riscv_cop/mcal_port.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
{
1515
namespace port
1616
{
17-
typedef void config_type;
17+
using config_type = void;
1818

19-
inline auto init(const config_type*) -> void { }
19+
auto init(const config_type*) -> void;
2020

2121
template<const std::uint32_t bpos>
2222
class port_pin

ref_app/target.vcxproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,9 @@
11491149
<ClCompile Include="target\micros\xtensa_esp32_s3\startup\crt1.cpp" />
11501150
<ClCompile Include="target\micros\xtensa_esp32_s3\startup\Std\StdLib.cpp" />
11511151
<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\Startup\Startup.c" />
1152+
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup\crt0.cpp" />
1153+
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup\crt0_init_ram.cpp" />
1154+
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup\crt1.cpp" />
11531155
</ItemGroup>
11541156
<ItemGroup>
11551157
<Text Include="target\micros\bcm2835_raspi_b\startup\SD_CARD\PiZero\config.txt" />

ref_app/target.vcxproj.filters

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,12 +1004,18 @@
10041004
<ClCompile Include="target\micros\xtensa_esp32_s3\startup\Std\StdLib.cpp">
10051005
<Filter>micros\xtensa_esp32_s3\startup\Std</Filter>
10061006
</ClCompile>
1007-
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup\Startup.c">
1008-
<Filter>micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup</Filter>
1009-
</ClCompile>
10101007
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Appli\main.cpp">
10111008
<Filter>micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Appli</Filter>
10121009
</ClCompile>
1010+
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup\crt1.cpp">
1011+
<Filter>micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup</Filter>
1012+
</ClCompile>
1013+
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup\crt0.cpp">
1014+
<Filter>micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup</Filter>
1015+
</ClCompile>
1016+
<ClCompile Include="target\micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup\crt0_init_ram.cpp">
1017+
<Filter>micros\xtensa_esp32_s3_riscv_cop\startup\from_no_sdk\Code\Startup</Filter>
1018+
</ClCompile>
10131019
</ItemGroup>
10141020
<ItemGroup>
10151021
<Text Include="target\micros\bcm2835_raspi_b\startup\SD_CARD\PiZero\config.txt">

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

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,50 @@
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, 0x04, 0xA9, 0x66, 0xA9, 0x67
6-
.byte 0x23, 0xA0, 0x06, 0x40, 0x03, 0xA6, 0x87, 0x4C, 0xB7, 0x05, 0x08, 0x00, 0x93, 0x86, 0x06, 0x40
7-
.byte 0x4D, 0x8E, 0x23, 0xA4, 0xC7, 0x4C, 0x23, 0xA6, 0x07, 0x46, 0x03, 0xA7, 0xC7, 0x40, 0x37, 0x06
8-
.byte 0x00, 0x08, 0x51, 0x8F, 0x23, 0xA6, 0xE7, 0x40, 0x98, 0x42, 0xB7, 0x07, 0x0C, 0x00, 0x31, 0x8F
9-
.byte 0x98, 0xC2, 0x01, 0x00, 0xFD, 0x17, 0xF5, 0xFF, 0xC5, 0xBF, 0x00, 0x00, 0xB7, 0x16, 0x00, 0x50
10-
.byte 0x83, 0xA7, 0x86, 0x00, 0x41, 0x11, 0x06, 0xC6, 0x22, 0xC4, 0x26, 0xC2, 0x7D, 0x56, 0x93, 0x86
11-
.byte 0x86, 0x00, 0x63, 0x83, 0xC7, 0x02, 0xD8, 0x42, 0x63, 0x00, 0xC7, 0x02, 0x81, 0x47, 0x09, 0xCB
12-
.byte 0x98, 0x42, 0x3E, 0x97, 0x23, 0x00, 0x07, 0x00, 0xD8, 0x42, 0x85, 0x07, 0xE3, 0xEA, 0xE7, 0xFE
13-
.byte 0x9C, 0x46, 0xA1, 0x06, 0xE3, 0x91, 0xC7, 0xFE, 0x37, 0x17, 0x00, 0x50, 0x83, 0x27, 0x87, 0x01
14-
.byte 0xFD, 0x55, 0x13, 0x07, 0x87, 0x01, 0x05, 0x45, 0x63, 0x86, 0xB7, 0x04, 0x54, 0x43, 0x63, 0x83
15-
.byte 0xB6, 0x04, 0x1C, 0x47, 0x63, 0x80, 0xB7, 0x04, 0x95, 0xCB, 0x1C, 0x43, 0x83, 0xC7, 0x07, 0x00
16-
.byte 0x93, 0xF7, 0xF7, 0x0F, 0x23, 0x80, 0xF6, 0x00, 0x1C, 0x47, 0x63, 0x71, 0xF5, 0x02, 0x85, 0x47
17-
.byte 0x10, 0x43, 0x54, 0x43, 0x3E, 0x96, 0x03, 0x46, 0x06, 0x00, 0xBE, 0x96, 0x85, 0x07, 0x13, 0x76
18-
.byte 0xF6, 0x0F, 0x23, 0x80, 0xC6, 0x00, 0x14, 0x47, 0xE3, 0xE4, 0xD7, 0xFE, 0x5C, 0x47, 0x31, 0x07
19-
.byte 0xE3, 0x9E, 0xB7, 0xFA, 0xB7, 0x17, 0x00, 0x50, 0x83, 0xA7, 0x07, 0x00, 0x37, 0x14, 0x00, 0x50
20-
.byte 0xFD, 0x54, 0x13, 0x04, 0x44, 0x00, 0x63, 0x87, 0x97, 0x00, 0x82, 0x97, 0x1C, 0x40, 0x11, 0x04
21-
.byte 0xE3, 0x9D, 0x97, 0xFE, 0x21, 0x37, 0x01, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
5+
.byte 0x17, 0x11, 0x00, 0x00, 0x13, 0x01, 0xC1, 0x43, 0x6F, 0x00, 0x80, 0x20, 0x41, 0x11, 0x06, 0xC6
6+
.byte 0x21, 0x22, 0xB2, 0x40, 0x41, 0x01, 0x82, 0x80, 0xB7, 0x16, 0x00, 0x50, 0x03, 0xA7, 0x86, 0x01
7+
.byte 0xB7, 0x17, 0x00, 0x50, 0x93, 0x87, 0x07, 0x03, 0x3A, 0x95, 0x63, 0x74, 0xF5, 0x00, 0x23, 0xAC
8+
.byte 0xA6, 0x00, 0x3A, 0x85, 0x82, 0x80, 0x00, 0x00, 0x82, 0x80, 0x00, 0x00, 0x82, 0x80, 0x00, 0x00
9+
.byte 0x01, 0x00, 0xFD, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x01, 0x45, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00
10+
.byte 0x01, 0x45, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xFD, 0xBF, 0x00, 0x00, 0x00, 0x00
11+
.byte 0x01, 0x00, 0xFD, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xFD, 0xBF, 0x00, 0x00, 0x00, 0x00
12+
.byte 0x01, 0x00, 0xFD, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x05, 0x45, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00
13+
.byte 0x01, 0x45, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7D, 0x55, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00
14+
.byte 0x7D, 0x55, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x45, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00
15+
.byte 0x01, 0x45, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x45, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00
16+
.byte 0x01, 0x45, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x45, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00
17+
.byte 0x7D, 0x55, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00, 0x82, 0x80, 0x00, 0x00, 0x01, 0x45, 0x82, 0x80
18+
.byte 0x00, 0x00, 0x00, 0x00, 0x01, 0x45, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00, 0x82, 0x80, 0x00, 0x00
19+
.byte 0x01, 0x11, 0x2E, 0xC2, 0x32, 0xC4, 0x36, 0xC6, 0x3A, 0xC8, 0x3E, 0xCA, 0x42, 0xCC, 0x46, 0xCE
20+
.byte 0x01, 0xA0, 0x00, 0x00, 0x37, 0x15, 0x00, 0x50, 0x13, 0x05, 0x05, 0x03, 0x82, 0x80, 0x00, 0x00
21+
.byte 0x41, 0x11, 0x06, 0xC6, 0xC5, 0x3F, 0x83, 0x47, 0x05, 0x00, 0x81, 0xE7, 0x85, 0x47, 0x23, 0x00
22+
.byte 0xF5, 0x00, 0xB2, 0x40, 0x41, 0x01, 0x82, 0x80, 0x01, 0x45, 0x81, 0x45, 0x82, 0x80, 0x00, 0x00
23+
.byte 0x03, 0x45, 0x45, 0x00, 0x82, 0x80, 0x00, 0x00, 0x82, 0x80, 0x00, 0x00, 0x82, 0x80, 0x00, 0x00
24+
.byte 0xA9, 0x67, 0x83, 0xA6, 0x07, 0x40, 0x03, 0x47, 0x45, 0x00, 0x37, 0x06, 0x00, 0x08, 0xB1, 0x8E
25+
.byte 0x23, 0xA0, 0xD7, 0x40, 0x93, 0x47, 0x17, 0x00, 0x23, 0x02, 0xF5, 0x00, 0x82, 0x80, 0x00, 0x00
26+
.byte 0xA1, 0x45, 0xED, 0xB5, 0xB7, 0x17, 0x00, 0x50, 0x03, 0xC7, 0x87, 0x03, 0x41, 0x11, 0x22, 0xC4
27+
.byte 0x06, 0xC6, 0x37, 0x14, 0x00, 0x50, 0x19, 0xC7, 0xB2, 0x40, 0x13, 0x05, 0x04, 0x04, 0x22, 0x44
28+
.byte 0x41, 0x01, 0x82, 0x80, 0xA9, 0x66, 0x03, 0xA6, 0x06, 0x40, 0x37, 0x17, 0x00, 0x50, 0x93, 0x05
29+
.byte 0x04, 0x04, 0x37, 0x08, 0x00, 0x08, 0x13, 0x07, 0x87, 0x00, 0x98, 0xC1, 0x33, 0x66, 0x06, 0x01
30+
.byte 0x23, 0xA0, 0xC6, 0x40, 0x03, 0xA6, 0x86, 0x4C, 0x37, 0x05, 0x08, 0x00, 0x36, 0x87, 0x49, 0x8E
31+
.byte 0x23, 0xA4, 0xC6, 0x4C, 0x23, 0xA6, 0x06, 0x46, 0x83, 0xA6, 0xC6, 0x40, 0x37, 0x05, 0x00, 0x50
32+
.byte 0x13, 0x05, 0xC5, 0x13, 0xB3, 0xE6, 0x06, 0x01, 0x23, 0x26, 0xD7, 0x40, 0x05, 0x47, 0x23, 0x82
33+
.byte 0x05, 0x00, 0x23, 0x8C, 0xE7, 0x02, 0x49, 0x35, 0xB2, 0x40, 0x13, 0x05, 0x04, 0x04, 0x22, 0x44
34+
.byte 0x41, 0x01, 0x82, 0x80, 0xA9, 0x67, 0x23, 0xA0, 0x07, 0x40, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00
35+
.byte 0x41, 0x11, 0x01, 0x45, 0x06, 0xC6, 0x22, 0xC4, 0xF5, 0x37, 0x01, 0x45, 0x11, 0x3F, 0x37, 0x14
36+
.byte 0x00, 0x50, 0x8D, 0x37, 0x1C, 0x41, 0x9C, 0x47, 0x82, 0x97, 0x37, 0x07, 0x06, 0x00, 0x83, 0x27
37+
.byte 0x84, 0x04, 0x7D, 0x17, 0x85, 0x07, 0x23, 0x24, 0xF4, 0x04, 0x75, 0xFB, 0xDD, 0xB7, 0x00, 0x00
38+
.byte 0x41, 0x11, 0x06, 0xC6, 0x31, 0x20, 0xAD, 0x20, 0xE1, 0x37, 0x01, 0x00, 0x01, 0x00, 0xF5, 0xBF
39+
.byte 0xB7, 0x16, 0x00, 0x50, 0x37, 0x17, 0x00, 0x50, 0x93, 0x86, 0xC6, 0x01, 0x93, 0x05, 0x87, 0x01
40+
.byte 0xB7, 0x17, 0x00, 0x50, 0x33, 0x85, 0xB6, 0x40, 0x13, 0x86, 0x87, 0x01, 0x2A, 0x96, 0x63, 0x8D
41+
.byte 0xB6, 0x00, 0x13, 0x07, 0x87, 0x01, 0x93, 0x87, 0x87, 0x01, 0x94, 0x43, 0x91, 0x07, 0x11, 0x07
42+
.byte 0x23, 0x2E, 0xD7, 0xFE, 0xE3, 0x1B, 0xF6, 0xFE, 0xB7, 0x17, 0x00, 0x50, 0x37, 0x17, 0x00, 0x50
43+
.byte 0x93, 0x86, 0x07, 0x02, 0x13, 0x07, 0xC7, 0x04, 0x63, 0x89, 0xE6, 0x00, 0x93, 0x87, 0x07, 0x02
44+
.byte 0x23, 0xA0, 0x07, 0x00, 0x91, 0x07, 0xE3, 0x9D, 0xE7, 0xFE, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00
45+
.byte 0x41, 0x11, 0x22, 0xC4, 0x26, 0xC2, 0x37, 0x14, 0x00, 0x50, 0xB7, 0x14, 0x00, 0x50, 0x06, 0xC6
46+
.byte 0x93, 0x07, 0x84, 0x01, 0x93, 0x84, 0x84, 0x01, 0x63, 0x8A, 0x97, 0x00, 0x13, 0x04, 0x84, 0x01
47+
.byte 0x83, 0x27, 0xC4, 0xFF, 0x71, 0x14, 0x82, 0x97, 0xE3, 0x1C, 0x94, 0xFE, 0xB2, 0x40, 0x22, 0x44
48+
.byte 0x92, 0x44, 0x41, 0x01, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2249
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2350
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2451
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@@ -230,33 +257,5 @@ coprocessor_bin:
230257
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
231258
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
232259
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
233-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
234-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
235-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
236-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
237-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
238-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
239-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
240-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
241-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
242-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
243-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
244-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
245-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
246-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
247-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
248-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
249-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
250-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
251-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
252-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
253-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
254-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
255-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
256-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
257-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
258-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
259-
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
260-
.byte 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x30, 0x10, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00
261-
.byte 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x30, 0x10, 0x00, 0x50, 0x30, 0x10, 0x00, 0x50
262-
.byte 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
260+
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x50, 0x60, 0x01, 0x00, 0x50
261+
.byte 0x40, 0x01, 0x00, 0x50, 0x30, 0x01, 0x00, 0x50, 0x28, 0x10, 0x00, 0x50

ref_app/target/micros/xtensa_esp32_s3_riscv_cop/make/xtensa_esp32_s3_riscv_cop.ld

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
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: */
19
/******************************************************************************************
210
Filename : coprocessor.ld
311
@@ -15,9 +23,6 @@
1523
1624
******************************************************************************************/
1725

18-
/******************************************************************************************
19-
ELF Entrypoint
20-
******************************************************************************************/
2126
ENTRY(_start)
2227

2328
/******************************************************************************************
@@ -51,75 +56,50 @@ SECTIONS
5156
/* Read-only data (.rodata) (note: esp32-s3 has not data access path on I_SRAM, rodata must be move to D_SRAM) */
5257
.rodata : ALIGN(4)
5358
{
54-
PROVIDE(__RODATA_BASE_ADDRESS = .);
5559
*(.rodata)
60+
. = ALIGN(4);
61+
*(.rodata*)
62+
. = ALIGN(4);
5663
PROVIDE(__INTVECT_BASE_ADDRESS = .);
5764
*(.intvect_core*)
65+
. = ALIGN(4);
5866
} > D_SRAM
5967

6068
/* Section for constructors */
6169
.ctors : ALIGN(4)
6270
{
63-
PROVIDE(__CPPCTOR_LIST__ = .);
71+
_ctors_begin = .;
6472
KEEP (*(SORT(.ctors.*)))
6573
KEEP (*(.ctors))
6674
KEEP (*(SORT(.init_array.*)))
6775
KEEP (*(.init_array))
68-
LONG(-1) ;
69-
PROVIDE(__CPPCTOR_END__ = .);
76+
_ctors_end = .;
7077
. = ALIGN(4);
7178
} > D_SRAM
7279

73-
74-
/* Section for destructors */
75-
.dtors : ALIGN(4)
76-
{
77-
PROVIDE(__CPPDTOR_LIST__ = .);
78-
KEEP (*(SORT(.dtors.*)))
79-
KEEP (*(.dtors))
80-
KEEP (*(SORT(.fini_array.*)))
81-
KEEP (*(.fini_array))
82-
LONG(-1) ;
83-
PROVIDE(__CPPDTOR_END__ = .);
84-
. = ALIGN(4);
85-
} > D_SRAM
86-
87-
/* Runtime clear table */
88-
.clear_sec : ALIGN(4)
89-
{
90-
PROVIDE(__RUNTIME_CLEAR_TABLE = .) ;
91-
LONG(0 + ADDR(.bss)); LONG(SIZEOF(.bss));
92-
LONG(-1); LONG(-1);
93-
. = ALIGN(4);
94-
} > D_SRAM
95-
96-
/* Runtime copy table (note: note needed on esp32-s3 bootROM copied the data from flash to SRAM) */
97-
#if 0
98-
.copy_sec : ALIGN(4)
99-
{
100-
PROVIDE(__RUNTIME_COPY_TABLE = .) ;
101-
LONG(LOADADDR(.data)); LONG(0 + ADDR(.data)); LONG(SIZEOF(.data));
102-
LONG(-1); LONG(-1); LONG(-1);
103-
. = ALIGN(4);
104-
} > D_SRAM
105-
#endif
106-
10780
/* The ROM-to-RAM initialized data section */
10881
.data : ALIGN(4)
10982
{
110-
PROVIDE(__DATA_BASE_ADDRESS = .);
83+
_data_begin = .;
11184
*(.data)
11285
*(.data*)
86+
_data_end = .;
11387
} > D_SRAM
11488

11589
/* The uninitialized (zero-cleared) bss section */
11690
.bss : ALIGN(4)
11791
{
118-
PROVIDE(__BSS_BASE_ADDRESS = .);
92+
_bss_begin = .;
11993
*(.bss)
12094
*(.bss*)
95+
_bss_end = .;
12196
} > D_SRAM
12297

98+
PROVIDE(end = .);
99+
PROVIDE(_fini = .);
100+
101+
_rom_data_begin = LOADADDR(.data);
102+
123103
/* stack definition */
124104
.stack :
125105
{

ref_app/target/micros/xtensa_esp32_s3_riscv_cop/make/xtensa_esp32_s3_riscv_cop_files.gmk

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111

1212
FILES_CPP :=
1313

14-
FILES_TGT := $(PATH_TGT)/startup/from_no_sdk/Code/Appli/main \
14+
FILES_TGT := $(PATH_APP)/mcal/mcal_gcc_cxx_completion \
15+
$(PATH_APP)/mcal/$(TGT)/mcal_gpt \
16+
$(PATH_APP)/mcal/$(TGT)/mcal_led \
17+
$(PATH_APP)/mcal/$(TGT)/mcal_port \
18+
$(PATH_TGT)/startup/from_no_sdk/Code/Appli/main \
1519
$(PATH_TGT)/startup/from_no_sdk/Code/Startup/boot \
1620
$(PATH_TGT)/startup/from_no_sdk/Code/Startup/IntVectTable \
17-
$(PATH_TGT)/startup/from_no_sdk/Code/Startup/Startup
21+
$(PATH_TGT)/startup/from_no_sdk/Code/Startup/crt0 \
22+
$(PATH_TGT)/startup/from_no_sdk/Code/Startup/crt0_init_ram \
23+
$(PATH_TGT)/startup/from_no_sdk/Code/Startup/crt1

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,29 @@
2323
2424
******************************************************************************************/
2525

26+
#include <mcal_gpt.h>
27+
#include <mcal_led.h>
2628
#include <mcal_port.h>
2729

28-
#include <cstdint>
29-
30-
extern "C"
31-
void main();
32-
33-
extern "C"
34-
void main()
30+
namespace
3531
{
36-
// Set all GPIO out registers to low.
37-
mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::rtc_gpio_out_reg, UINT32_C(0)>::reg_set();
32+
volatile std::uint32_t main_counter { };
33+
}
3834

39-
// Configure GPIO17 as output low.
40-
using port_pin_type = mcal::port::port_pin<UINT32_C(17)>;
35+
extern "C" void main();
4136

42-
port_pin_type::set_direction_output();
37+
extern "C" void main()
38+
{
39+
mcal::port::init(nullptr);
40+
mcal::gpt::init(nullptr);
4341

4442
for(;;)
4543
{
46-
port_pin_type::toggle_pin();
44+
mcal::led::led0().toggle();
4745

48-
for(uint32_t i=0; i< 0xC0000; i++)
46+
for(std::uint32_t loop { UINT32_C(0) }; loop < std::uint32_t { UINT32_C(0x00060000) }; ++loop)
4947
{
50-
asm volatile("nop");
48+
main_counter = std::uint32_t { main_counter + UINT8_C(1) };
5149
}
5250
}
5351
}

0 commit comments

Comments
 (0)