encryption application spend more time to run.

rdrodrigues17 wrote on Monday, September 23, 2019:

Hi, guys!

I am using the IDE Keil MDK-ARM Professional 5.27, NXP MIMXRT1064 and FREERTOS 10.2.

I have an encryption application that runs on a memory of 5MBytes.

When running in “bare metal”, it runs the entire process within 10 milli seconds.
The same application, when running on a “FreeRTOS” task, it takes 1minunte 40 seconds.

Why is it spending so much time running on FreeRTOS?
How do problem solve or reduce ?

Who can help me or give some ideas about problem?

Thanks for attetion.

Best regards,
Rogerio Dias

rtel wrote on Monday, September 23, 2019:

What is the priority of the task in which the encryption algorithm is
executing? What else is your application doing and at what priority?
What is the tick frequency? Have you traced the application to see
where the CPU cycles are going?

rdrodrigues17 wrote on Monday, September 23, 2019:

Hi, Richard!
Thanks for your question!

Today, the task priority encrypton is 5.
Tasks priority other are 4.


// Total heap size [bytes] <0-0xFFFFFFFF>
// Heap memory size in bytes.
// Default: 8192
#define configTOTAL_HEAP_SIZE ((size_t)30720)

// Kernel tick frequency [Hz] <0-0xFFFFFFFF>
// Kernel tick rate in Hz.
// Default: 1000
#define configTICK_RATE_HZ ((TickType_t)1000)

I also write the code below;

n = 0;
vTaskSuspendAll();

encrypton(); //my aplication with 5Mbytes;

xTaskResumeAll();

When it is running the task, it takes 1minute 40 second.
The same application, I also use one task to application. It is the same result.

About the CPU cycles,
I have been problem whit my trace (Event Record and other function Keil). I am not watching the CPU cycles.

Thanks.

richard_damon wrote on Monday, September 23, 2019:

One question to look at, has the conversion from ‘Bare Metal’ to running under FreeRTOS moved the location of the Stack or other data memories that you use a lot from internal ram to external ram?

Has it perhaps changed how caches are setup?

rdrodrigues17 wrote on Monday, September 23, 2019:

Hi, Richard!
Thanks for your question!

Today, the task priority encrypton is 5.

Tasks priority other are 4.

// Total heap size [bytes] <0-0xFFFFFFFF>
// Heap memory size in bytes.
// Default: 8192
#define configTOTAL_HEAP_SIZE ((size_t)30720)

// Kernel tick frequency [Hz] <0-0xFFFFFFFF>
// Kernel tick rate in Hz.
// Default: 1000
#define configTICK_RATE_HZ ((TickType_t)1000)

I also write the code below;

n = 0;

vTaskSuspendAll();

encrypton(); //my aplication with 5Mbytes;

xTaskResumeAll();

When it is running the task, it takes 1minute 40 second.

The same application, I also use one task to application. It is the same
result.

About the CPU cycles,

I have been problem whit my trace (Event Record and other function Keil). I
am not watching the CPU cycles.

Thanks.

Em seg, 23 de set de 2019 às 12:06, Richard Barry <
rtel@users.sourceforge.net> escreveu:

What is the priority of the task in which the encryption algorithm is
executing? What else is your application doing and at what priority?
What is the tick frequency? Have you traced the application to see
where the CPU cycles are going?

encryption application spend more time to run.
https://sourceforge.net/p/freertos/discussion/382005/thread/076e9c063a/?limit=25#d263/a82a

Sent from sourceforge.net because you indicated interest in
https://sourceforge.net/p/freertos/discussion/382005/

To unsubscribe from further messages, please visit
https://sourceforge.net/auth/subscriptions/

rdrodrigues17 wrote on Monday, September 23, 2019:

Hi, Richard!
I 'm using NXP MIMXRT1064 internal RAM. It’s my application encrypton!
This moment, I don’t need to change other RAM or memory other.
I already am problem internal RAM.

My test,
It is running to “Beta-metal”.
I am using berfore " vTaskStartScheduler();"

I send to my test below:

encrypton(); //my aplication with 5Mbytes; --> it takes 10 milli seconds

vTaskStartScheduler();

Richard,
some questions.
What are kind do memory Before and After “vTaskStartScheduler();” ?
if they are different, how do I direct to the same position?

richard_damon wrote on Monday, September 23, 2019:

You are saying that you application is using 5 MB of RAM. Most processors don’t have 5 MB of internal RAM, so you probably have some internal RAM and some External RAM. Generally, for program startup, the processor stack is pointed to the internal ram which is faster. When you create your task, it will have its stack allocatted from somewhere. Depending on how you do that, it could be placed in the internal RAM or the External RAM. If you are using one of the heap versions that use a statically allocated memory block for the heap, then it depends where you had the system allocate that block of memory. If it is in the External Ram, then that is often slower to access, and thus your program will slow down.

Changing the type of memory you are running in could have a noticable factor in running speed, and I first read your time change as from 10 seconds to 1 minute 40 secords (a factor of 10) which is a bit bigger than I would expect, but might be possible. I now see that your other time was 10 ms, and that level of slow down (x10,000) is likely a sign that in some way the program isn’t really the same (doing something extra that burns 99.99% of the processor time)

rdrodrigues17 wrote on Monday, September 23, 2019:

Richard,
Excuse me, my mistake.

Really,
My aplication in 5x 1024 Bytes RAM internal.

5KBytes.

NXP MIMXRT1064 is 1M Bytes RAM internal.

I don´t have Ram external.

It is very stranger functionaly.

Thank your very much for information.