Arduino High Priority Interrupt

jrl290
Posts: 1
Joined: Sun Jan 29, 2023 9:14 pm

Arduino High Priority Interrupt

Postby jrl290 » Fri Feb 17, 2023 8:15 pm

Although I'm not fully familiar with the high priority interrupt, I'm able to set one up without the Arduino libraries linked. When I have the Arduino libraries linked (needed for Arduino_GPS.h, TimeLib.h, Wire.h) I get this error:
/Users/james/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /Users/james/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/lib/libesp_system.a(highint_hdl.S.obj): in function `xt_highint5':
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/port/soc/esp32/highint_hdl.S:173: multiple definition of `xt_highint5'; .pio/build/adafruit_feather_esp32_v2/src/highint5.S.o:(.iram1+0x0): first defined here
My understanding is that xt_highint5 is weakly defined in ESPIDF, which makes it possible to overload it. How might I overload or bypass the duplicate definition?

My assembly code:

Code: Select all

#include <xtensa/coreasm.h>
#include <xtensa/corebits.h>
#include <xtensa/config/system.h>
#include "freertos/xtensa_context.h"
#include "esp_private/panic_reason.h"
#include "sdkconfig.h"
#include "soc/soc.h"
#include "soc/gpio_reg.h"
#include "soc/dport_reg.h"

#define L5_INTR_STACK_SIZE  12
#define LX_INTR_A15_OFFSET 0
#define LX_INTR_A14_OFFSET 4
#define LX_INTR_A13_OFFSET 8
    .data
_l5_intr_stack:
    .space      L5_INTR_STACK_SIZE

    .section .iram1,"ax"
    .global     xt_highint5
    .type       xt_highint5,@function
    .align      4
xt_highint5:

    movi    a0, _l5_intr_stack // assuming a0 saved restored by EXCSAVE_5 at the end of this
    s32i    a15, a0, LX_INTR_A15_OFFSET
    s32i    a14, a0, LX_INTR_A14_OFFSET
    s32i    a13, a0, LX_INTR_A13_OFFSET

    /* Clear interupt on GPIO27 */
    movi    a14, GPIO_STATUS_W1TC_REG
    movi    a15, (1 << 27)
    s32i     a15, a14, 0
    memw


    movi a14, 0x3FF5F00C    //Timer 0 Update address into a10
    s32i a0, a14, 0         //A write instruction copies the timer to the timer registers
    movi a14, timer0_value  //timer0_value address into a11
    movi a15, 0x3FF5F004    //Timer 0 lower 32 bits address
    l32i a13, a15, 0
    s32i a13, a14, 0        //Store lower 32 bits to timer0_value
    movi a15, 0x3FF5F008    //Timer 0 upper 32 bits address
    l32i a13, a15, 0
    s32i a13, a14, 4        //Store upper 32 bits to timer0_value
    memw

    l32i    a15, a0, LX_INTR_A15_OFFSET
    l32i    a14, a0, LX_INTR_A14_OFFSET
    l32i    a13, a0, LX_INTR_A13_OFFSET

    rsr     a0, EXCSAVE_5 // restore a0
    rfi     5

    .global ld_include_xt_highint5
ld_include_xt_highint5:

Who is online

Users browsing this forum: No registered users and 53 guests