This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/MSP430FR5848: Place void __interrupt _c_int00_noargs_noexit(void) at a particular location in memory

Part Number: MSP430FR5848

Tool/software: TI C/C++ Compiler

Hi there,

I have the requirement to be able to place the program's entry point (the function pointer that gets reflected by the address stored in section .reset) at a pre-determined address.

To my understanding the linker does this without instruction currently and links _c_int00_noargs_noexit at some stage but it is not deterministic. Instead, I can see that main always gets placed deterministically at my .text section's beginning but I have been able to mess this up deliberately by changing the link priority.

I want to write a script that changes the output binary to have a custom entry point in a specific page and I can do this with my deterministic page code and placing the entry point (0xA000) in 0xFFFE (.reset), but to call _c_int00_noargs_noexit afterwards is not possible because its location cannot be known, and if the program that exists in A400 through FFFF changes, the code in the 0xA000 page can no longer call it.

I plan to have a bootloader of-sorts in this page, that determines whether or not the code in 0xA400-0xFFFF matches a CRC, and if it does, it will call its _c_int00_noargs_noexit, otherwise it copies the image from 0x4400-0x9FFF into 0xA400-0xFFFF and then calls the respective _c_int00_noargs_noexit that has to be in the same location.

I think so far, the only option I see is to modify boot and possibly boot_special sources/headers to have the correct pragmas.

Is there a better way?

Edit:

I read in another thread I might just be able to add .text:_c_int00_noargs_noexit : {} > 0xA000 in my linker script, is that a solution?

  • Hi,
    I'am a little confused. Do you want to put a function code A in 0xA400-0xFFFF and a function code B in 0x4400-0x9FFF. If function code A is OK, MCU will run function code A. If not, the MCU will move code B to code A and run code B?
    1. The address in reset vector is not the entrance of main function. It will enter _c_int00_template(int NEEDS_ARGS, int NEEDS_INIT, int NEEDS_MPU).
    And it will do some work(stack init; global variable init; register init). Then it will run the main function.
    2. Code A can't put in 0xA400-0xFFFF. There is a interrupt vector table on the top of the memory.
    3. Your requirement is quite same as dual image bootloader in main memory. Here is the link: www.ti.com/.../slaa721b.pdf
    Eason
  • I wasn't suggesting main was the entry point, I'm well aware it's _c_int00_noargs_noexit (in my case) and I have heavily customised this build and compiler arguments to make it function in a highly optimised fashion. There is no cinit, binit, pinit, args, cio, exidx, extab and consequently the program enters _c_int00_noargs_noexit and calls sys_pre_init and then main.

    I cannot use the UART bootloader because the protocol I am using for comms is bit-banged and large - it ios contained within the program image.

    The memory is laid out as follows:

    IMAGE: 0x4400-9FFF (IMAGE_VECTOR_TABLE: 0x9F80-9FFF, entry point: _c_int00_noargs_noexit() @ (*)(void ) 0x9FFE)
    UPDATE: 0xA000-A3FF
    PROGRAM: 0xA400-FFFF (IMAGE_VECTOR_TABLE: 0xFF80-FFFF, entry point: _c_int00_noargs_noexit() @ (*)(void ) 0xFFFE)

    When the PROGRAM runs, it can receive an image and can write it into IMAGE after verifying a CRC over a protocol.
    IMAGE also contains the same code that can receive the IMAGE data. Both IMAGE and PROGRAM contain vector tables in their last 0x80 bytes.
    UPDATE contains a function that manages the MPU and copies IMAGE into PROGRAM then sets SWPOR | PMMSWPOR in PMMCTL0.

    I desire instead of entering in PROGRAM, to enter in UPDATE and verify PROGRAM before changing the SP to 0x23FE and the PC to 0xA400.

    To achieve this I need to place _c_int00_noargs_noexit in 0xA400 when the linker runs.

    Edit: I should note, PROGRAM and IMAGE are not relocatable, they are both linked to run from 0xA400-FFFF, as a result the pages from 0x440-9F0 are never executed, only accessed as read/write.

  • Hi,
    I read in another thread I might just be able to add .text:_c_int00_noargs_noexit : {} > 0xA000 in my linker script, is that a solution?
    Yes, it is a solution.
    Eason
  • just thought I should add it has to be .text:_isr:_c_int00_noargs_noexit

**Attention** This is a public forum