Posted on 2005-04-27
I have needs for an 'srec' file. To do this, I thought perhaps I could first create a binary file, then convert the file to srec using a 'tool' called objcopyppc.
char mbyte[ 1048576];
std::ofstream ofile( "bigfile.bin" );
int i = 0;
int m = 0;
std::cout << "how many MiB shall I write? ";
std::cin >> m;
for( i = 0; i < m; ++i )
ofile.write( (char*)mbyte, sizeof mbyte );
I'll need to tweak the code above to ask the user to select a pattern. ie. Choose betwen all zeros, or all ones or a counting pattern (1, 2, 3, .. ).
Conversly is it possible to just write code that'll generate the srec file withouth going through all this.