-deleted-
9 years ago.

BootLoader_K64F as a Class?

What would be the advantage of using these functions in a class, for example?

__attribute__((section(".ARM.__at_0x10000" ))) class bootLoaderClass { //Program Sector Location
    private:
        void write(char *value) {
            int i = 0;
            //Loop through string and send everything
            while(*(value+i) != '\0') {
                while(!(UART0->S1 & UART_S1_TDRE_MASK));
                UART0->D = *(value+i);
                i++;
            }
        }
};

.

One advantage I can think of is that there is only one Flash memory location to reference in terms of sector location ".ARM.at_0x10000"?

Another advantage might be that the bootloader class could extend the FreeScaleIAP if this was a class?

I would like to understand when to take advantage of classes and when to avoid classes.

Question relating to:

Example of a Serial bootloader for the K64F platform bootloader, FreescaleIAP, K64F

1 Answer

9 years ago.

It would then need to be a completely static class, since a regular one with constructor makes little sense in this case. I did consider it, however since I didn't see the advantage of doing that here I just sticked to C functions.

You are correct it might make it easier to put the whole thing in a different memory location, so it is an idea to change it to a static class. Although I am not 100% sure that that would actually work. For example the functions are in flash, but private variables would be in RAM (not that it has any, but in general).

Accepted Answer

Thank you for the info on the need for a static class. I will do some tests.

posted by -deleted- 08 Apr 2015