2020-02-21 12:16 AM
Hi,
I want to draw grid to a graph, which has many tick lines + tick texts (up to 10 vertical + 10 horizontal).
In addition to this, I have the Graph widget drawn inside the same container:
https://github.com/touchgfx/touchgfx-open-repository/tree/master/widgets/Graph
When I add these grid lines in for loop like such:
for (int i = 0; i < HTICK_COUNT ; i++)
{
remove(htickline[i]);
... add line color, position, width, etc. ...
add(htickline[i]);
}
...
touchgfx::Line htickline[HTICK_COUNT];
The application will crash at boot when there is too many children added. In my case, adding 14 lines + 14 texts will halt the program.
Is this supposed to happen? How many childs can I safely add?
I think I can avoid this using canvas painter, but I still want to know is this normal behavior when adding too many childs. Should not be a RAM problem, I have statically allocated these drawables?
EDIT:
might be resource problem. The simulator can run a lot of lines and texts. I'm using stm32-f4-disc1 board, with SINGLE_BUFFERING disabled.
Thanks!
2020-02-21 05:49 AM
Simulator? Target? Are you running an OS? If so, is your task stack size large enough? heap size? cstack?
/Martin
2020-02-21 07:10 AM
Windows simulator works, but STM32F4-DISC1 target does not. FreeRTOS OS.
My config is following:
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( SystemCoreClock )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 8 )
#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 128*2 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 8 * 1024 ) ) /* 4 Kbytes */
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configCHECK_FOR_STACK_OVERFLOW 0
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_MALLOC_FAILED_HOOK 0
#define configUSE_APPLICATION_TASK_TAG 1
#define configUSE_COUNTING_SEMAPHORES 1
#define configGENERATE_RUN_TIME_STATS 0
> If so, is your task stack size large enough? heap size? cstack?
Ok, this probably is the problem.
I could not find how to change cstack.
Increasing configMINIMAL_STACK_SIZE over 256 will crash my application.
Thanks!
2020-02-22 05:16 AM
Seems like a stack overflow
2020-02-22 05:18 AM
2020-02-24 12:21 AM
Ok, do you have any suggested remedy for this issue?
I think my options are:
Thanks!
2020-02-24 04:58 AM
The last option shouldn't be necessary, i think. It's a matter of optimizing the application and allocation, so don't bother with stack and heap sizes just yet.
Can you explain more about the application and what you're trying to do?
/Martin
2020-02-24 05:51 AM
Well it is measuring equipment, which displays a graph of data. Graph has grid, which has x and y axis lines and tickmarks beside the grid showing the values of each line.
A.k.a. just a normal plotting measurement data into a grid.
I also must be able to show 2 grids simultaneously!
When the grid is divided to 5-10 lines, there will be a lot of Line Drawables to add().
If add too many grid lines, or add second graph container to same View, the application will crash at startup. With Windows simulator both work fine.