I have some binary data in text file: file name: bin_data: 0x04 0x82 0x48 0x69
I have converted them into binary using ld -r -b binary -o bin_data.o bin_data
I have written one CPP program
file name: check.cpp
#include<stdio.h>
#include<stdint.h>
#include "data.h"
using namespace std;
extern char _binary_bin_data_start[];
extern char _binary_bin_data_end[];
int main()
{
printf(" start \n");
printf( "address of start: %p\n", &_binary_bin_data_start);
printf( "address of end: %p\n", &_binary_bin_data_end);
for (char* p = _binary_bin_data_start; p != _binary_bin_data_end; ++p)
{
putchar( *p);
}
return 0;
}
I have compiled the check.cpp & created check.o.
in order to read the data I need to link both the file and generate a.o to run the program. In my application bin_data will change for every simulation and I dont want to compile check.o * bin_data.o every time. is there any work around here? so that I don't have to link check.o & bin_data.o evry time there is a change in bin_data.
Aucun commentaire:
Enregistrer un commentaire