Flowcode calling flowcode

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Errol
Posts: 39
Joined: Wed May 18, 2011 11:15 pm
Has thanked: 9 times
Contact:

Flowcode calling flowcode

Post by Errol »

Does anyone know if you can have one flowcode program call (execute) a second flowcode program?
Or
Maybe have part of the program in eeprom (or several function in eeprom) where flowcode can load those functions as needed?

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Flowcode calling flowcode

Post by JonnyW »

Hi.

Can you expand on your question - do you mean in simulation or downloaded? Assuming downloaded, what it sounds like you need to do is self-modifying code: loading a block of data into memory and then executing it.

This is possible using assembly language, but I imagine that when code is executed out of ROM anyway (as it is on the PIC) this would have limited use. Perhaps reading code off an SD card using FAT and executing could be more use. There are various considerations in doing this, such as use of absolute addresses meaning code needs to be loaded into an exact memory location.

Do you mind me asking why you need this - it may be possible there are alternatives that would be easier to do, as how I understand it the architecture of the PIC is not very nice for this kind of thing. Assuming you are working with a PIC.

If what you are trying to do is create a self contained block of code, this is similar to how the components work. v6 will make creating your own self-contained components in Flowcode easier, but in v5 you can use the custom components to do this.

Jonny

Errol
Posts: 39
Joined: Wed May 18, 2011 11:15 pm
Has thanked: 9 times
Contact:

Re: Flowcode calling flowcode

Post by Errol »

Hi JonnyW
Yes, "loading a block of data into memory and then executing it". I thought about using a SD but that increases the overall code size. I am work with time and volumes. There are three or four function that are call maybe every 3 to 4 weeks (not all at the same time) so it is just wasted code space to have them loaded all the time. That is where an eeprom or even a prom would work.
Yes I'm using PIC (starting to think this is the wrong product to be using)
When do think V6 will be released? I hope it will have auto single step in it (see earlier post of mine).

Thanks for your help
Errol

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Flowcode calling flowcode

Post by JonnyW »

Hi. If you write some assembly code that is written to execute at a certain location, you can write that code in to executable memory at that location and execute it.

I have done this before for bootloaders, but not with a PIC. I cant personally help you with the ASM or workings of the PIC, I'm afraid.

There are some considerations here:
- You have to be able to execute code from RAM. Otherwise you are copying from EEPROM to FLASH then executing, which will eventually wear the FLASH out.

- The PIC has a max of 256 (or 128?) bytes per page. I would assume if it is possible to execute from RAM at all your code needs to fit inside this - I expect your loading routine would be at least this size to do so anyway.

- The code has to either be written to execute from any location or mapped to a specific address - this probably means knowing the linker settings on your chip.

While I would consider the above pretty straight-forward with something like an ARM which is easily written as relocatable code, I don't know how hard this would be for the PIC. Writing an entire routine in Flowcode, ripping the HEX to a block of data (including dependencies such as the CAL routines) then linking this into EEPROM to load into RAM on your chip sounds like a lot of work.

Good luck,

Jonny

Post Reply