How to dereference a specific address in memory through dereferencing another address in memory?

0

I'm using a bootloader as a hex and s19 files in my project, so i'm not allowed to modify its content. In this bootloader there is a part implemented in the following way to verify if my application is a valid application:

#define CHECK_PATTERN_ADDRESS ((int32)0x00020000)
#define VALID_PATTERN             ((int16)0xE900)
#define VALID_PATTERN_MASK        ((int16)0xFF00)

    int16    pattern_data = *(int16 *)CHECK_PATTERN_ADDRESS;
    if ((pattern_data & VALID_PATTERN_MASK) == VALID_PATTERN)
    {
        //Valid application
    }
    else
    {
        //Not Valid application
    }

From the above code, for the bootloader to consider my application as valid, it is needed to put the valid pattern in the mentioned address "0x00020000".

This pattern is loaded directly to this address while downloading the application.

This is done by using an assembly file containing this pattern and by specifying the address where it will be loaded in the memory through the linker file.

So, currently the valid pattern is loaded successfully in the mentioned address "0x00020000" during the download process of my application.

The main constrain is:

The bootloader should find the valid pattern in this specific address "0x00020000"

The problem is:

I need to add my valid pattern in another address "let's say 0x00040000" while the DLL will keep de-referencing the data from the requested address "0x00020000" ..

Still, it is Okay for me to add any data through an assembly file to the original address "0x00020000", or to directly add any specific hex data to this address.

The Question is:

What can i load in this address "0x00020000", such that when the bootloader uses it in its code "as provided above" it will take the values loaded in the other address "0x00040000"

c++
c
assembly
embedded
bootloader
asked on Stack Overflow Aug 10, 2016 by Mohab Altlaity • edited Aug 10, 2016 by Mohab Altlaity

1 Answer

1

At 0x00020000 you can put the starting point of the code that is aware of your 0x00040000 "extensions". Then, without any further midifications your bootloader will be booting that code as usualy, and that code (let's refer to it as a "secodary bootloader") will boot the code you placed under 0x00040000.

answered on Stack Overflow Aug 11, 2016 by OpalApps

User contributions licensed under CC BY-SA 3.0