Sharing variable (struct) in Bootloader with Application

I am wanted to write a bootloader. If an application is already programmed, it transfers control to the bootloader with an interrupt call (_trap_0x7F). The bootloader needs several informations form the application (ECU-adress,...). This informations are hold in a struct, which is located at the same adress in the application and the bootloader.

#include <Schnittstelle.H>

#pragma NOINIT
struct SchnittstellenDefinition volatile far Schnittstelle;
#pragma INIT

I declared #pragma NOINIT for disable initialization or clearing the struct. But if i read out the content of the struct in the bootloader, the values are not correct. What could cause this error?

Parents
  • I declared #pragma NOINIT for disable initialization or clearing the struct. But if i read out the content of the struct in the bootloader, the values are not correct.

    You said that the contents of the struct were not correct, but you didn't say they were all zeros. It probably means that your problem is not related to the NOINIT pragma.
    I am assuming that for locating the struct at a specific memory address you used the technique described here:
    http://www.keil.com/support/docs/586.htm
    And hopefully you took the necessary precautions when calling bootloader code from the main application, such as saving and restoring registers.
    It would be very helpful if you could set up a debugger. If that is problematic, you could communicate some debugging info from the microcontroller using some peripherals, like a display or a serial port.

    Regards,
    - mike

Reply
  • I declared #pragma NOINIT for disable initialization or clearing the struct. But if i read out the content of the struct in the bootloader, the values are not correct.

    You said that the contents of the struct were not correct, but you didn't say they were all zeros. It probably means that your problem is not related to the NOINIT pragma.
    I am assuming that for locating the struct at a specific memory address you used the technique described here:
    http://www.keil.com/support/docs/586.htm
    And hopefully you took the necessary precautions when calling bootloader code from the main application, such as saving and restoring registers.
    It would be very helpful if you could set up a debugger. If that is problematic, you could communicate some debugging info from the microcontroller using some peripherals, like a display or a serial port.

    Regards,
    - mike

Children
More questions in this forum