High Level Interrupt linking issue;
Posted: Mon Nov 28, 2022 12:24 am
Hello All ;
I'm working simple GPIO capture project. it should work fastest as much as possible. So decided to use High Level Interrupt.
I guess , i couldn't compile it in correct way, when the interrupt occurs, its directly jump to default routines ( "xtensa_vector_default.S")
My code is below. Could you please help me how to link my asm file in correct-way ?
C Code: define the gpio and interrupt
Asm Code:
Cmake :
Thanks.
I'm working simple GPIO capture project. it should work fastest as much as possible. So decided to use High Level Interrupt.
I guess , i couldn't compile it in correct way, when the interrupt occurs, its directly jump to default routines ( "xtensa_vector_default.S")
My code is below. Could you please help me how to link my asm file in correct-way ?
C Code: define the gpio and interrupt
Code: Select all
REG_SET_BIT(DPORT_CPU_PERI_CLK_EN_REG, DPORT_CLK_EN_DEDICATED_GPIO);
REG_CLR_BIT(DPORT_CPU_PERI_RST_EN_REG, DPORT_RST_EN_DEDICATED_GPIO);
/* get the values of dedicated GPIO from the CPU, not peripheral registers */
REG_WRITE(DEDICATED_GPIO_OUT_CPU_EN_REG, 0xff);
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[config->pin_xclk], PIN_FUNC_GPIO);
gpio_set_direction(config->pin_xclk, GPIO_MODE_OUTPUT);
gpio_set_pull_mode(config->pin_xclk, GPIO_FLOATING);
gpio_matrix_out(config->pin_xclk, PRO_ALONEGPIO_OUT0_IDX , false, false);
gpio_config_t io_conf = {0};
io_conf.intr_type = GPIO_PIN_INTR_NEGEDGE;
io_conf.pin_bit_mask = 1ULL << config->pin_href;
io_conf.mode = GPIO_MODE_INPUT;
io_conf.pull_up_en = 1;
io_conf.pull_down_en = 0;
gpio_config(&io_conf);
//ESP_INTR_DISABLE(31);
//intr_matrix_set(1, ETS_GPIO_INTR_SOURCE, 31);
//ESP_INTR_ENABLE(31);
esp_intr_alloc(ETS_GPIO_INTR_SOURCE, ESP_INTR_FLAG_LEVEL5|ESP_INTR_FLAG_IRAM, NULL, NULL, NULL);
Code: Select all
#include <xtensa/coreasm.h>
#include <xtensa/corebits.h>
#include <xtensa/config/system.h>
#include "soc/gpio_reg.h"
#define DRDY_INT_PIN_BITMASK (1<<14) // GPIO14 as interrupt pin
.data
_l5_intr_stack:
.space 8
.section .iram1,"ax"
.global xt_highint5
.type xt_highint5,@function
.align 4
xt_highint5:
//save register values
movi a0, _l5_intr_stack
s32i a13, a0, 0
s32i a15, a0, 4
// cleare the interrupt status of GPIO14(used interrupt pint!)
movi a13, GPIO_STATUS_W1TC_REG
movi a15, DRDY_INT_PIN_BITMASK
s32i a15, a13, 0
//Add Couple of ns to Wait
nop
nop
nop
nop
nop
//Clear the corespanding Dedicated GPIO output
clr_bit_gpio_out 0x1
//restore register values
movi a0, _l5_intr_stack
l32i a13, a0, 0
l32i a15, a0, 4
rsr a0, EXCSAVE_5
rfi 5
.global ld_include_highint_hdl
ld_include_highint_hdl:
Code: Select all
set(COMPONENT_ADD_INCLUDEDIRS "include" ".")
#set(COMPONENT_PRIV_INCLUDEDIRS "include .")
SET(ASM_OPTIONS "-x assembler-with-cpp")
SET(CMAKE_ASM_FLAGS "${CFLAGS} ${ASM_OPTIONS}" )
set(COMPONENT_SRCS "int_GPIO14.s")
#set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u ld_include_highint_hdl")
register_component()
target_link_libraries(${COMPONENT_LIB} "-u ld_include_highint_hdl")
Thanks.