qsort in standard library for DSC / MC56F800

cancel
Showing results for 
Search instead for 
Did you mean: 

qsort in standard library for DSC / MC56F800

290 Views
spacedog
Contributor I

Is the qsort() library function implemented as recursive function or not.

 

From MISRA 2012, Rule 21.9, page 170

 

The implementation of qsort is likely to be recursive and will therefore place unknown demands on stack resource. This is of concern in embedded systems as the stack is likely to be a fixed, often small size.

 

This rule raises a good question. I plan to use this function. As I want to be on the safe side I would like to have this question answered.

Labels (1)
0 Kudos
1 Reply

87 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Colin,

You are right, the DSC chip has limited internal SRAM, the stack space is predefined in the linker file when you compile the project, you have to predict the recursive loop number and allocate the corresponding stack space, it is not possible to allocate stack dynamically in application code.

Hope it can help you.

BR

Xiangjun Rong

0 Kudos