Below is my code without the "printf"-output code to check progress. I checked and it says that it writes the data.
When I read back the result with a similar program, although it seems to have written the bootloader successfully at first, it returns all zeroes with the read program.
I did make sure I have root permissions. I have the size of the program instead of PROGRAM_SIZE and the filename of the bootloader instead of "bootloader."
I can't really tell whether there's something wrong with my programming or some kind of interference by the Operating System.
Code:
#include <stdio.h>
unsigned char uca_CMOS[PROGRAM_SIZE] __attribute__((section(".ARM.__at_0x0000000000000000")));
unsigned long int uli_counter = 0;
FILE * Fp_load;
int main(int i_argc, char** cpa_argv) {
if (Fp_load = fopen("bootloader", "r")) {
while (!feof(Fp_load)) {
uca_CMOS[uli_counter] = getc(Fp_load);
uli_counter++;
}
fclose(Fp_load);
}
}