Execute another program from a code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Execute another program from a code

1,488 Views
pandurang
Contributor I

Hello All,

I am using FRDM-KW36.

In one of my applications, I need to run a small code and check for a condition. If condition is satisfied, execute another program stored in P-Flash at location other than 0x0000_0000.

Both codes are separate and stored in P-Flash.

Is this possible? If not, what can be the reasons and what can be the solutions.

Thanks and Regards,

Pandurang

Labels (1)
Tags (2)
0 Kudos
9 Replies

1,239 Views
pandurang
Contributor I

Hello All,

Waiting for reply. Kindly give some clue.

Thanks and Regards,

Pandurang

0 Kudos

1,239 Views
pandurang
Contributor I

Hello ErichS‌,

The given code-lines are not working. What I have to do to execute another program (code) stored in a flash from running code?

0 Kudos

1,239 Views
ErichStyger
Senior Contributor V

Yes, this is possible. This is for example what bootloaders do or a normal application can do too.

Just set up a function pointer and call it.

0 Kudos

1,239 Views
pandurang
Contributor I

Thanks Erich.

Yes I assumed the same. I implemented like this but it didn't work.

In my first small code, I have:

void (* App2)(void) = (void (*)())(0x3C00);

main application is stored at 0x3C00.

When condition is satisfied,

I have done:

App2();

But this is not working!

Is this correct? If yes, what can be the reason for not working? If no, what changes I require to do?

Thanks and Regards,

Pandurang

0 Kudos

1,239 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

Are you working with a connectivity framework example ? How are you managing the different tasks and radio interruptions if so when you are executing that other code? Are you using some mutex or semaphore to achieve that ?

Regards,

Estephania

0 Kudos

1,239 Views
pandurang
Contributor I

Hello Estephania,

It seems that you have replied by mistake to my post.

Regards,

Pandurang

0 Kudos

1,239 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

I did not reply by mistake, still if you which you can wait for another reply.

Just for you to consider that you need to take into account the wireless connectivity framework and the scheduler that is being used there to ensure that your program does not get lost.

Regards,

Estephania

0 Kudos

1,239 Views
pandurang
Contributor I

Hello Estephania,

Sorry, but I thought it might not be relevant as you mentioned about wireless connectivity and my query is about to execute another code.

And thank you for your reply.

Now, coming to your point, Yes, my next (main) application will have wireless connectivity framework. And what I am assuming is that I will load that main application with wireless connectivity at some location, let's say, 0x3C00 in flash. And in my first code, when condition is satisfied, I need that code at 0x3C00 would be executed.

How should I do that?

Thanks and Regards,

Pandurang

0 Kudos

1,239 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

I believe that you can use the OTA (Over the air programming) example as a base as it does exactly what you need. It uploads the program from a wireless network and execute is. You can check and read more about this in the BLE Application Developer's Guide which is available in the SDK

<installation path>\docs\wireless\Bluetooth

I believe that the chapter 11.8 OTAP bootloader might have an answer to what you need.

Regards,

Estephania

0 Kudos