MSP430X custom bootloader interrupt vector overflows for 1M memory size

Comments

9 comments

  • Avatar
    Michael Johnson

    Function pointers are implemented by calling into an indirection table held in the low 64K of memory. This way all pointers are 16-bit but code execution is supported across the full 1M address space.

    0
    Comment actions Permalink
  • Avatar
    Arun Kumar

    So, why is it failing when the memory size is changed from 64K to 1M?

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    You can't assign an arbitrary address to a function pointer and call it when built for a 1M address space.

    1
    Comment actions Permalink
  • Avatar
    Arun Kumar

    Are there any workarounds/alternatives for it?

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    I'm afraid you'll have to use assembly code to implement the call from the bootloader to the application.

    1
    Comment actions Permalink
  • Avatar
    Arun Kumar

    That did the trick. Thanks a lot Michael.

    0
    Comment actions Permalink
  • Avatar
    Arun Kumar

    Quick question. Why does the function pointer works while in application, but not from bootloader (same config -> MSP430X, 1M)

    // The below command works while in application

        typedef void (*fnptr)(void);
        fnptr jaf = (fnptr)0xfffe;
        (*jaf)();

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    Not sure - I'd single step through the assembly code...

    0
    Comment actions Permalink
  • Avatar
    Arun Kumar

    Will do so. Thanks Michael.

    0
    Comment actions Permalink

Please sign in to leave a comment.