4 Replies Latest reply on Apr 22, 2020 7:50 PM by MoTa_728816

    My interrupt_cfg is undeclared ... why?

    MoTa_728816

      Hi,

       

      While I was trying to port my TinyBasic Sample of PSoC 4 (and 5LP) to PSoC 6

      I encountered an interesting difficulty.

      Tiny Basic for PSoC (CY8CKIT-044 / TSoC / CY8CKIT-059 / CY8CKIT-062-BLE)

       

      I used CY8CKIT-062-BLE (without e-Ink display).

       

      What I was trying was registering my isr to uart's external interrupt.

      The schematic was

      000-schematic.JPG

      And in my tty initialization I wrote

      =======================

      void tty_init(void)

      {

          Cy_SysInt_Init(&tty_rx_int_cfg, tty_rx_isr) ;

          NVIC_ClearPendingIRQ(tty_rx_int_cfg.intrSrc) ;

          NVIC_EnableIRQ((IRQn_Type)tty_rx_int_cfg.intrSrc) ;

       

          UART_Start() ;

      }

      =======================

       

      Then I got an error

      ===========

      prj.M0120:Build error: 'tty_rx_int_cfg' undeclared (first use in this function)

      ===========

       

      So I tried to "Go to definition" of "tty_rx_int_cfg"

       

      Then it was in cyfitter_sysint_cfg.h

      ===============

      /* ARM CM4 */

      #if (((__CORTEX_M == 4) && (CY_CORE_ID == 0)))

          #define tty_rx_int__INTC_ASSIGNED 1u

          extern const cy_stc_sysint_t tty_rx_int_cfg;

       

      #endif /* ((__CORTEX_M == 4) && (CY_CORE_ID == 0)) */

      ===============

       

      and in cyfitter_sysint_cfg.c

      ===============

      #include "cyfitter_sysint.h"

      #include "cyfitter_sysint_cfg.h"

       

      /* ARM CM4 */

      #if (((__CORTEX_M == 4) && (CY_CORE_ID == 0)))

       

          /* tty_rx_int */

          const cy_stc_sysint_t tty_rx_int_cfg = {

              .intrSrc = (IRQn_Type)tty_rx_int__INTC_NUMBER,

              .intrPriority = tty_rx_int__INTC_CORTEXM4_PRIORITY

          };

       

      #endif /* ((__CORTEX_M == 4) && (CY_CORE_ID == 0)) */

      ===============

       

      To test if this source is valid in my project,

      I added

      #define ISR_ASSIGNED 1

      in the previous line of /* ARM CM4 */

      and from the main.c ISR_ASSIGNED was 1.

      So I assumed that cyfitter_sysint_cfg.c is linked.

       

      Then I wonder why tty_rx_int_cfg came out to be undeclared?

       

      Since I wanted to build this project anyway, I added same declaration inside my function,

      ==============

      void tty_init(void)

      {

      #if 1

           /* tty_rx_int */

          const cy_stc_sysint_t tty_rx_int_cfg = {

              .intrSrc = (IRQn_Type)tty_rx_int__INTC_NUMBER,

              .intrPriority = tty_rx_int__INTC_CORTEXM4_PRIORITY

          };

      #endif

       

          Cy_SysInt_Init(&tty_rx_int_cfg, tty_rx_isr) ;

          NVIC_ClearPendingIRQ(tty_rx_int_cfg.intrSrc) ;

          NVIC_EnableIRQ((IRQn_Type)tty_rx_int_cfg.intrSrc) ;

       

       

          UART_Start() ;

      }

      ==============

       

      Then the project could be compiled and the TinyBasic seems to be working OK.

       

      But I still wonder why I needed to this.

      Did I forget something to make the declaration in the "cyfitter_sysint_cfg.c" valid?

      Or am I doing something (anything?) wrong with preparing a project for PSoC 6?

       

      Any suggestion(s) and/or help(s) will  be greatly appreciated.

       

      moto