Forums - Onboard_demo stack issue

10 posts / 0 new
Last post
Onboard_demo stack issue
angus.ku
Join Date: 3 May 18
Posts: 20
Posted: Tue, 2018-06-12 04:17

Hi~

We run demo code[Onboard_demo], it seems abnormal.

System will be halted and QCLI_Thread isn't running when it is going to Start_onboard_demo();

-----------------------------------------------------------------------------------------------

I posted the main entry function point of this application. 

 

void app_start(qbool_t ColdBoot)
{
   print_banner();
   qurt_thread_attr_t Thread_Attribte;
   qurt_thread_t      Thread_Handle;
   int                Result;
   if(PAL_Context.Initialized)
   {
      /* Start the main demo thread. */
      qurt_thread_attr_init(&Thread_Attribte);
      qurt_thread_attr_set_name(&Thread_Attribte, "QCLI Thread");
      qurt_thread_attr_set_priority(&Thread_Attribte, PAL_THREAD_PRIORITY);
      qurt_thread_attr_set_stack_size(&Thread_Attribte, PAL_THREAD_STACK_SIZE);
      Result = qurt_thread_create(&Thread_Handle, &Thread_Attribte, QCLI_Thread, NULL);
      if(Result != QURT_EOK)
      {
         PAL_CONSOLE_WRITE_STRING_LITERAL("Failed to start QCLI thread.");
         PAL_CONSOLE_WRITE_STRING_LITERAL(PAL_OUTPUT_END_OF_LINE_STRING);
         PAL_CONSOLE_WRITE_STRING_LITERAL(PAL_OUTPUT_END_OF_LINE_STRING);
      }
      Start_onboard_demo();
   }
}

-----------------------------------------------------------------------------------------------

I set ecosystem to AWS IOT and run the following commad to build this application

> build.bat f 4020 2 1 1 cdb

I guessed it may be stack issues, so I try to remove either QCLI thread or  Start_onboard_demo()

After that, it can run.

We would like to know if anything should be set or adjusted?? and How do we know the stack size of QCLI thread is used??

Many Thx!!

  • Up0
  • Down0
jbhanu Moderator
Join Date: 6 Feb 17
Posts: 80
Posted: Tue, 2018-06-12 05:36

Hi , 

So you are using FreeRTOS and trying to run onboard via BLE. Right? 

Thanks 

  • Up0
  • Down0
angus.ku
Join Date: 3 May 18
Posts: 20
Posted: Tue, 2018-06-12 18:11

Hi

We are using FreeRTOS and trying to run onboard via WIFI

------------------------------------------------------

*The value of Onboarding Mode parameter for build command  which is listed in Development Kit User Guide is different from build.bat.

In Development Kit User Guide:

Onboarding Mode : 1 WIFI , 2 BLE

In build.bat:

1 (BLE), 2 (WIFI)

------------------------------------------------------

Thx~

 

 

  • Up0
  • Down0
jbhanu Moderator
Join Date: 6 Feb 17
Posts: 80
Posted: Tue, 2018-06-12 23:14

Hi

have you followed 3.8 FreeRTOS and QuRT  of UG  to generate FreeRTOs and Qurt lib? 

Also I see you are using below command to build .

build.bat f 4020 2 1 1 cdb .

2 means BLE. Please use 1 for WIFI . 

Thanks

Jyotiranjan 

 

 

  • Up0
  • Down0
angus.ku
Join Date: 3 May 18
Posts: 20
Posted: Wed, 2018-06-13 01:13

Hi

Yes, I have followed.

And, you can see the parameter is opposite in build.bat

----------------

IF "%ONBOARD_VIA%" == "1" (
set ONBOARD_VIA=BLE
) ELSE IF "%ONBOARD_VIA%" == "2" (
set ONBOARD_VIA=WIFI
)

 

Thanks

  • Up0
  • Down0
angus.ku
Join Date: 3 May 18
Posts: 20
Posted: Wed, 2018-06-13 02:41

Btw, If it use threadx, it is ok. 

Besides, I used freertos and threax respectively in Helloworld_demo.

In function App_Start, I try to created other 4  threads after creating HelloWorld_Thread.

all of stack size are 3072, and priorities are 11, 12,  13 and 14 respectively .

If I use threax, they all can be created; however, if I use freertos, some of them will return -3 (QURT_EMEM)

Does there have any functino call that we can know how many stack size of each thread is used?

Thanks

  • Up0
  • Down0
jbhanu Moderator
Join Date: 6 Feb 17
Posts: 80
Posted: Thu, 2018-06-14 03:24

You Mean all/On board demo  work fine with threadx.  Issue is with only FreeRTOS? How you check stack size for now?

Thanks 

  • Up0
  • Down0
angus.ku
Join Date: 3 May 18
Posts: 20
Posted: Thu, 2018-06-14 20:04

Yes, On board demo  work fine with threadx.  Issue is with only FreeRTOS.

So It seems to be something wrong with FreeRTOS

  • Up0
  • Down0
manjulak Moderator
Join Date: 5 Dec 14
Posts: 33
Posted: Wed, 2018-06-20 10:33

Can you please follow below instructions in section 4.3.4( Resize application memory) from 80-YA121-142 (QCA402x(CDB2x)Programmers Guide) document and add extra 6KB for freeRTOS heap for onboard demo to successfully work when using FreeRTOS.

"FreeRTOS requires a dedicated memory pool used for allocating RTOS specific elements such as task stack. OEMs might adjust this allocation based on their needs by following the steps.
cd to "./FreeRTOS/2.0/FreeRTOS/Demo/QUARTZ" directory. Edit FreeRTOSConfig.h, change configTOTAL_HEAP_SIZE to the appropriate value.
Rebuild FreeRTOS library. Refer to QCA402x Development Kit User Guide (80-YA121-140).
cd to target/bin/cortex-m4/freertos. Edit DefaultTemplateLinkerScript.ld, change RTOS_HEAP_SIZE to match configTOTAL_HEAP_SIZE from step 1.
Build the application. The new FreeRTOS heap value is applied."

  • Up0
  • Down0
angus.ku
Join Date: 3 May 18
Posts: 20
Posted: Fri, 2018-06-22 00:04

OK,  I see.

Many Thanks

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.