7 Replies Latest reply on Sep 15, 2014 10:29 AM by lewis_1490776

    Porting an app from the 20732S to the 20736S

    lewis_1490776

      I have developed a custom board based on the 20732S module and would like to migrate to the 20736S.

      I built a few of our boards using the 20736S chip, and am currently trying to get our app to work on them.

       

      I am successfully able to download and run "Hello Sensor" to my board using the 2.1.0 SDK.

       

      However, when I try running my app that I developed in the 1.1.0 SDK, it seems to get what looks like a stack overflow in the create() function.

       

       

      14:26:14 -

      14:26:14 -  permission check retCode = 00

      14:26:14 - b4

      14:26:14 - b400

      14:26:14 - HELLO=0

       

      <slight delay>

      <booting again...>

       

      14:26:14 -

      14:26:14 - 0201060409546167

      14:26:14 - 020a02

      14:26:14 -

      14:26:14 -  permission check retCode = 00

      14:26:14 - b4

      14:26:14 - b400

      14:26:14 - HELLO=0

      14:26:15 -

      14:26:15 - 0201060409546167

      14:26:15 - 020a02

      14:26:15 -

      14:26:15 -  permission check retCode = 00

      14:26:15 - b4

      14:26:15 - b400

      14:26:15 - HELLO=0

      14:26:15 -

      14:26:15 - 0201060409546167

      14:26:15 - 020a02

       

      The last line in my create() function calls another function to complete board initialization.  If I put a trace directly before that function call, it prints out; but putting a trace at the very start of the other function never prints, and then it reboots.

       

      It's as if calling that function overwrites the stack and crashes the device.

       

      Any ideas what is going on here?  Is the application stack on the new SDK smaller than on the old one?

      Is there any way to debug this?

       

       

       

       

      void application_create(void)

      {

          extern UINT32 blecm_configFlag ;

          blecm_configFlag |= BLECM_DBGUART_LOG | BLECM_DBGUART_LOG_L2CAP | BLECM_DBGUART_LOG_SMP;

       

          bleprofile_Init(bleprofile_p_cfg);

          bleprofile_GPIOInit(bleprofile_gpio_p_cfg);

       

          // Configure battery monitor

          blebat_batmon_cfg.fullVoltage = 1800;

          blebat_batmon_cfg.emptyVoltage = 0;

          blebat_batmon_cfg.shutdownVoltage = 0;

          blebat_batmon_cfg.maxLevel = 180;

          blebat_Init();

       

          // register connection up and connection down handler.

          bleprofile_regAppEvtHandler(BLECM_APP_EVT_LINK_UP, connection_up);

          bleprofile_regAppEvtHandler(BLECM_APP_EVT_LINK_DOWN, connection_down);

          bleprofile_regAppEvtHandler(BLECM_APP_EVT_ADV_TIMEOUT, advertisement_stopped);

       

          //register to receive write callbacks

          legattdb_regWriteHandleCb((LEGATTDB_WRITE_CB)write_handler);

       

          ble_trace0("HELLO=0\n");   // <-- this runs.

       

          // system bootup

          boot_start();

      }

       

       

      void boot_start()

      {

        BLEPROFILE_DB_PDU db_pdu;

        UINT8 i;

        ble_trace0("HELLO=1\n");   // <-- this never runs.

       

        UINT8 *addr = emconinfo_getAddr();

        UINT8 unexpected_boot = 0;

       

        ble_trace0("HELLO1\n");

        // Test mode input pin

        UINT16 mask[3] = {1<<2,0,0};

        gpio_registerForInterrupt(mask, boot_test_mode_button_cb, NULL);

        gpio_configurePin(0,2,GPIO_OUTPUT_DISABLE | GPIO_INPUT_ENABLE | GPIO_PULL_UP | GPIO_EN_INT_FALLING_EDGE, 0);

        // Clear out any spurious interrupt status.

        gpio_clearPinInterruptStatus(0,2);

       

      ...