diff --git a/readme.md b/readme.md index f790143ee..e15826f2f 100644 --- a/readme.md +++ b/readme.md @@ -406,10 +406,12 @@ The multicore system first boots core0 which subsequently starts up core1 and also starts up the RISCV coprocessor core. Blinky runs in the standard `ref_app` on core0 toggling `port7` while an endless timer loop on core1 -toggles `port6`. The LED ports togle in near unison at $\frac{1}{2}~\text{Hz}$. -Self-procured LEDs and resistors need to be fitted in order to observe -blinky on this particular board. The RISCV coprocessor -toggles `port17` at a randomly chosen, visible frequency. +toggles `port6`. These LED ports togle in near unison +at the normal blinky feequency of $\frac{1}{2}~\text{Hz}$. +The RISCV coprocessor toggles `port17` at a randomly chosen +frequency slightly higher than that of the regular blinky show. +Self-procured LEDs and resistors need to be fitted externally +on the port pins in order to observe blinking on this particular board. The NXP(R) OM13093 LPC11C24 board ARM(R) Cortex(R)-M0+ configuration called `target lpc11c24` toggles the LED on `port0.8`. diff --git a/ref_app/src/mcal/xtensa_esp32_s3_riscv_cop/mcal_port.cpp b/ref_app/src/mcal/xtensa_esp32_s3_riscv_cop/mcal_port.cpp index ecd3c92fd..928c9f949 100644 --- a/ref_app/src/mcal/xtensa_esp32_s3_riscv_cop/mcal_port.cpp +++ b/ref_app/src/mcal/xtensa_esp32_s3_riscv_cop/mcal_port.cpp @@ -7,8 +7,4 @@ #include -auto mcal::port::init(const config_type*) -> void -{ - // Set all GPIO out registers to low. - mcal::reg::reg_access_static::reg_set(); -} +auto mcal::port::init(const config_type*) -> void { } diff --git a/ref_app/src/mcal/xtensa_esp32_s3_riscv_cop/mcal_port.h b/ref_app/src/mcal/xtensa_esp32_s3_riscv_cop/mcal_port.h index 72cb3b1b2..dc68a65e7 100644 --- a/ref_app/src/mcal/xtensa_esp32_s3_riscv_cop/mcal_port.h +++ b/ref_app/src/mcal/xtensa_esp32_s3_riscv_cop/mcal_port.h @@ -29,12 +29,11 @@ public: static auto set_direction_output() -> void { - //RTC_IO_RTC_PAD17_REG |= (1ul << 19); - //RTC_GPIO_PIN17_REG = 0; - //RTC_GPIO_ENABLE_REG |= (1ul << (10 + 17)); - mcal::reg::reg_access_static::bit_set(); mcal::reg::reg_access_static::reg_set(); + + // Set the pin to output low. + mcal::reg::reg_access_static::bit_clr(); mcal::reg::reg_access_static::bit_set(); } @@ -49,7 +48,7 @@ static auto set_pin_low() -> void { - mcal::reg::reg_access_static::bit_set(); + mcal::reg::reg_access_static::bit_clr(); } static auto read_input_value() -> bool diff --git a/ref_app/target/micros/xtensa_esp32_s3/startup/coprocessor_binary.S b/ref_app/target/micros/xtensa_esp32_s3/startup/coprocessor_binary.S index aaee39f8c..40b167013 100644 --- a/ref_app/target/micros/xtensa_esp32_s3/startup/coprocessor_binary.S +++ b/ref_app/target/micros/xtensa_esp32_s3/startup/coprocessor_binary.S @@ -2,7 +2,7 @@ .global coprocessor_bin coprocessor_bin: .byte 0x6F, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x17, 0x11, 0x00, 0x00, 0x13, 0x01, 0xC1, 0x43, 0x6F, 0x00, 0x80, 0x20, 0x41, 0x11, 0x06, 0xC6 + .byte 0x17, 0x11, 0x00, 0x00, 0x13, 0x01, 0xC1, 0x43, 0x6F, 0x00, 0x00, 0x22, 0x41, 0x11, 0x06, 0xC6 .byte 0x21, 0x22, 0xB2, 0x40, 0x41, 0x01, 0x82, 0x80, 0xB7, 0x16, 0x00, 0x50, 0x03, 0xA7, 0x86, 0x01 .byte 0xB7, 0x17, 0x00, 0x50, 0x93, 0x87, 0x07, 0x03, 0x3A, 0x95, 0x63, 0x74, 0xF5, 0x00, 0x23, 0xAC .byte 0xA6, 0x00, 0x3A, 0x85, 0x82, 0x80, 0x00, 0x00, 0x82, 0x80, 0x00, 0x00, 0x82, 0x80, 0x00, 0x00 @@ -25,28 +25,28 @@ coprocessor_bin: .byte 0x23, 0xA0, 0xD7, 0x40, 0x93, 0x47, 0x17, 0x00, 0x23, 0x02, 0xF5, 0x00, 0x82, 0x80, 0x00, 0x00 .byte 0xA1, 0x45, 0xED, 0xB5, 0xB7, 0x17, 0x00, 0x50, 0x03, 0xC7, 0x87, 0x03, 0x41, 0x11, 0x22, 0xC4 .byte 0x06, 0xC6, 0x37, 0x14, 0x00, 0x50, 0x19, 0xC7, 0xB2, 0x40, 0x13, 0x05, 0x04, 0x04, 0x22, 0x44 - .byte 0x41, 0x01, 0x82, 0x80, 0xA9, 0x66, 0x03, 0xA6, 0x06, 0x40, 0x37, 0x17, 0x00, 0x50, 0x93, 0x05 - .byte 0x04, 0x04, 0x37, 0x08, 0x00, 0x08, 0x13, 0x07, 0x87, 0x00, 0x98, 0xC1, 0x33, 0x66, 0x06, 0x01 - .byte 0x23, 0xA0, 0xC6, 0x40, 0x03, 0xA6, 0x86, 0x4C, 0x37, 0x05, 0x08, 0x00, 0x36, 0x87, 0x49, 0x8E - .byte 0x23, 0xA4, 0xC6, 0x4C, 0x23, 0xA6, 0x06, 0x46, 0x83, 0xA6, 0xC6, 0x40, 0x37, 0x05, 0x00, 0x50 - .byte 0x13, 0x05, 0xC5, 0x13, 0xB3, 0xE6, 0x06, 0x01, 0x23, 0x26, 0xD7, 0x40, 0x05, 0x47, 0x23, 0x82 - .byte 0x05, 0x00, 0x23, 0x8C, 0xE7, 0x02, 0x49, 0x35, 0xB2, 0x40, 0x13, 0x05, 0x04, 0x04, 0x22, 0x44 - .byte 0x41, 0x01, 0x82, 0x80, 0xA9, 0x67, 0x23, 0xA0, 0x07, 0x40, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00 - .byte 0x41, 0x11, 0x01, 0x45, 0x06, 0xC6, 0x22, 0xC4, 0xF5, 0x37, 0x01, 0x45, 0x11, 0x3F, 0x37, 0x14 - .byte 0x00, 0x50, 0x8D, 0x37, 0x1C, 0x41, 0x9C, 0x47, 0x82, 0x97, 0x37, 0x07, 0x06, 0x00, 0x83, 0x27 - .byte 0x84, 0x04, 0x7D, 0x17, 0x85, 0x07, 0x23, 0x24, 0xF4, 0x04, 0x75, 0xFB, 0xDD, 0xB7, 0x00, 0x00 - .byte 0x41, 0x11, 0x06, 0xC6, 0x31, 0x20, 0xAD, 0x20, 0xE1, 0x37, 0x01, 0x00, 0x01, 0x00, 0xF5, 0xBF - .byte 0xB7, 0x16, 0x00, 0x50, 0x37, 0x17, 0x00, 0x50, 0x93, 0x86, 0xC6, 0x01, 0x93, 0x05, 0x87, 0x01 - .byte 0xB7, 0x17, 0x00, 0x50, 0x33, 0x85, 0xB6, 0x40, 0x13, 0x86, 0x87, 0x01, 0x2A, 0x96, 0x63, 0x8D - .byte 0xB6, 0x00, 0x13, 0x07, 0x87, 0x01, 0x93, 0x87, 0x87, 0x01, 0x94, 0x43, 0x91, 0x07, 0x11, 0x07 - .byte 0x23, 0x2E, 0xD7, 0xFE, 0xE3, 0x1B, 0xF6, 0xFE, 0xB7, 0x17, 0x00, 0x50, 0x37, 0x17, 0x00, 0x50 - .byte 0x93, 0x86, 0x07, 0x02, 0x13, 0x07, 0xC7, 0x04, 0x63, 0x89, 0xE6, 0x00, 0x93, 0x87, 0x07, 0x02 - .byte 0x23, 0xA0, 0x07, 0x00, 0x91, 0x07, 0xE3, 0x9D, 0xE7, 0xFE, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00 - .byte 0x41, 0x11, 0x22, 0xC4, 0x26, 0xC2, 0x37, 0x14, 0x00, 0x50, 0xB7, 0x14, 0x00, 0x50, 0x06, 0xC6 - .byte 0x93, 0x07, 0x84, 0x01, 0x93, 0x84, 0x84, 0x01, 0x63, 0x8A, 0x97, 0x00, 0x13, 0x04, 0x84, 0x01 - .byte 0x83, 0x27, 0xC4, 0xFF, 0x71, 0x14, 0x82, 0x97, 0xE3, 0x1C, 0x94, 0xFE, 0xB2, 0x40, 0x22, 0x44 - .byte 0x92, 0x44, 0x41, 0x01, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x41, 0x01, 0x82, 0x80, 0x29, 0x67, 0x83, 0x25, 0x07, 0x40, 0xB7, 0x16, 0x00, 0x50, 0x37, 0x06 + .byte 0x00, 0xF8, 0x13, 0x08, 0x04, 0x04, 0x93, 0x86, 0x86, 0x00, 0x7D, 0x16, 0x23, 0x20, 0xD8, 0x00 + .byte 0xF1, 0x8D, 0x23, 0x20, 0xB7, 0x40, 0x03, 0x25, 0x87, 0x4C, 0xB7, 0x08, 0x08, 0x00, 0xBA, 0x86 + .byte 0x33, 0x65, 0x15, 0x01, 0x23, 0x24, 0xA7, 0x4C, 0x23, 0x26, 0x07, 0x46, 0x83, 0x25, 0x07, 0x40 + .byte 0x37, 0x05, 0x00, 0x50, 0x13, 0x05, 0xC5, 0x13, 0x6D, 0x8E, 0x23, 0x20, 0xC7, 0x40, 0x03, 0x27 + .byte 0xC7, 0x40, 0x37, 0x06, 0x00, 0x08, 0x51, 0x8F, 0x23, 0xA6, 0xE6, 0x40, 0x05, 0x47, 0x23, 0x02 + .byte 0x08, 0x00, 0x23, 0x8C, 0xE7, 0x02, 0x8D, 0x3D, 0xB2, 0x40, 0x13, 0x05, 0x04, 0x04, 0x22, 0x44 + .byte 0x41, 0x01, 0x82, 0x80, 0x82, 0x80, 0x00, 0x00, 0x41, 0x11, 0x01, 0x45, 0x06, 0xC6, 0xDD, 0x3F + .byte 0xB2, 0x40, 0x01, 0x45, 0x41, 0x01, 0x29, 0xB7, 0x00, 0x00, 0x00, 0x00, 0x41, 0x11, 0x22, 0xC4 + .byte 0x06, 0xC6, 0x37, 0x14, 0x00, 0x50, 0xCD, 0x37, 0xB1, 0x37, 0x1C, 0x41, 0x9C, 0x47, 0x82, 0x97 + .byte 0x37, 0x07, 0x06, 0x00, 0x83, 0x27, 0x84, 0x04, 0x7D, 0x17, 0x85, 0x07, 0x23, 0x24, 0xF4, 0x04 + .byte 0x75, 0xFB, 0xDD, 0xB7, 0x00, 0x00, 0x00, 0x00, 0x41, 0x11, 0x06, 0xC6, 0x31, 0x20, 0xAD, 0x20 + .byte 0xF1, 0x37, 0x01, 0x00, 0x01, 0x00, 0xF5, 0xBF, 0xB7, 0x16, 0x00, 0x50, 0x37, 0x17, 0x00, 0x50 + .byte 0x93, 0x86, 0xC6, 0x01, 0x93, 0x05, 0x87, 0x01, 0xB7, 0x17, 0x00, 0x50, 0x33, 0x85, 0xB6, 0x40 + .byte 0x13, 0x86, 0x87, 0x01, 0x2A, 0x96, 0x63, 0x8D, 0xB6, 0x00, 0x13, 0x07, 0x87, 0x01, 0x93, 0x87 + .byte 0x87, 0x01, 0x94, 0x43, 0x91, 0x07, 0x11, 0x07, 0x23, 0x2E, 0xD7, 0xFE, 0xE3, 0x1B, 0xF6, 0xFE + .byte 0xB7, 0x17, 0x00, 0x50, 0x37, 0x17, 0x00, 0x50, 0x93, 0x86, 0x07, 0x02, 0x13, 0x07, 0xC7, 0x04 + .byte 0x63, 0x89, 0xE6, 0x00, 0x93, 0x87, 0x07, 0x02, 0x23, 0xA0, 0x07, 0x00, 0x91, 0x07, 0xE3, 0x9D + .byte 0xE7, 0xFE, 0x82, 0x80, 0x00, 0x00, 0x00, 0x00, 0x41, 0x11, 0x22, 0xC4, 0x26, 0xC2, 0x37, 0x14 + .byte 0x00, 0x50, 0xB7, 0x14, 0x00, 0x50, 0x06, 0xC6, 0x93, 0x07, 0x84, 0x01, 0x93, 0x84, 0x84, 0x01 + .byte 0x63, 0x8A, 0x97, 0x00, 0x13, 0x04, 0x84, 0x01, 0x83, 0x27, 0xC4, 0xFF, 0x71, 0x14, 0x82, 0x97 + .byte 0xE3, 0x1C, 0x94, 0xFE, 0xB2, 0x40, 0x22, 0x44, 0x92, 0x44, 0x41, 0x01, 0x82, 0x80, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 diff --git a/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/make/xtensa_esp32_s3_riscv_cop_flags.gmk b/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/make/xtensa_esp32_s3_riscv_cop_flags.gmk index 8acc38dfb..59c51b29e 100644 --- a/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/make/xtensa_esp32_s3_riscv_cop_flags.gmk +++ b/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/make/xtensa_esp32_s3_riscv_cop_flags.gmk @@ -107,5 +107,8 @@ PYTHON := python RULE_SPECIAL_MAKE_IMAGE_FILE_PART01 := $(OBJCOPY) $(APP).$(TGT_SUFFIX) -O binary $(APP).bin RULE_SPECIAL_MAKE_IMAGE_FILE_PART02 := $(PYTHON) $(PATH_TGT)/startup/from_no_sdk/Scripts/bin2asm.py -i $(APP).bin -o $(PATH_BIN)/coprocessor_binary.S -s ".coprocessor" -l 16 -g coprocessor_bin +RULE_SPECIAL_MAKE_IMAGE_FILE_PART03 := $(PYTHON) $(PATH_TGT)/startup/from_no_sdk/Scripts/bin2asm.py -i $(APP).bin -o $(PATH_TGT)/../xtensa_esp32_s3/startup/coprocessor_binary.S -s ".coprocessor" -l 16 -g coprocessor_bin -RULE_SPECIAL_MAKE_IMAGE_FILE := $(RULE_SPECIAL_MAKE_IMAGE_FILE_PART01) && $(RULE_SPECIAL_MAKE_IMAGE_FILE_PART02) +RULE_SPECIAL_MAKE_IMAGE_FILE := $(RULE_SPECIAL_MAKE_IMAGE_FILE_PART01) \ + && $(RULE_SPECIAL_MAKE_IMAGE_FILE_PART02) \ + && $(RULE_SPECIAL_MAKE_IMAGE_FILE_PART03) diff --git a/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/from_no_sdk/Code/Appli/main.cpp b/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/from_no_sdk/Code/Appli/main.cpp index 43c3d6e04..a7b895f82 100644 --- a/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/from_no_sdk/Code/Appli/main.cpp +++ b/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/from_no_sdk/Code/Appli/main.cpp @@ -27,25 +27,42 @@ #include #include +extern "C" void main(); + +namespace mcal +{ + auto init() -> void; + + auto init() -> void + { + mcal::port::init(nullptr); + mcal::gpt::init(nullptr); + } +} + namespace { volatile std::uint32_t main_counter { }; -} -extern "C" void main(); + auto delay() -> void + { + constexpr std::uint32_t loop_count{ UINT32_C(0x00060000) }; + + for (std::uint32_t loop{ UINT32_C(0) }; loop < loop_count; ++loop) + { + main_counter = std::uint32_t { main_counter + UINT8_C(1) }; + } + } +} extern "C" void main() { - mcal::port::init(nullptr); - mcal::gpt::init(nullptr); + mcal::init(); for(;;) { mcal::led::led0().toggle(); - for(std::uint32_t loop { UINT32_C(0) }; loop < std::uint32_t { UINT32_C(0x00060000) }; ++loop) - { - main_counter = std::uint32_t { main_counter + UINT8_C(1) }; - } + delay(); } }