No announcement yet.

Banked Module Compilation Strategy

  • Filter
  • Time
  • Show
Clear All
new posts

  • Banked Module Compilation Strategy

    Is there anything wrong with this strategy? . . . .

    All Bank 1..5 code modules begin with code similar to this:

    func main(var f)
        if(f != SKETCHF) flash_Run(FLASHBANK_0);
    where SKETCHF is a constant whose value depends upon the target bank: 1111 for Bank 1, 2222 for Bank 2, etc.

    The idea is to compile a Bank 1..5 to flash, prevent it's running (since arguments aren't valid since it hasn't been called) and effectively perform a soft reset to Bank 0 so the application is up and running with the new Bank 1..5 code.

    But this results in a Workshop error message: "Failed to execute the program."

    Still, it appears to work as I'd hoped. I'm assuming that I can ignore this message?

    If I insert the statement: pause(1); before the if statement, I don't get the error message.


  • #2
    I don't think there's anything wrong with it.

    It just seems odd to do that.

    I get what you are trying to achieve, I'd just be more inclined to 'let the bank run' and do a reset by clicking on the traffic light in workshop.

    If something undesired could happen, I'd be inclined to just let the bank 'return' if the parameter was 'out of range'.


    • #3
      What's the "traffic light"? I don't see anything looking like one in my Designer toolbar. All I have is Compile and Compile and Load. Couldn't find a toolbar options menu.


      • #4
        In the comms tab underneath the comm port setting


        • #5
          Got it. Should have know it's function. Seems that since the approach above safely does the same thing and saves 3 mouse clicks, will probably continue as I am.

          Still looking for a way to always compile Banks 1..5 to flash and Bank 0 to RAM without having to go to Project>RAM/FLASH. I always run Banks 1..5 in flash but usually compile and run Bank 0 in RAM to save flash write cycles. Again, trying to save clicks since I compile frequently while developing and sometimes forget to do the RAM/FLASH toggle.