arkku / ihex Goto Github PK
View Code? Open in Web Editor NEWIntel HEX (IHEX) format read/write library in C
License: MIT License
Intel HEX (IHEX) format read/write library in C
License: MIT License
I have found a situation where if I have two logical blocks of data that happen to be adjacent on the 64kB address boundary, the Extended Linear Address header is never written.
It can be mimicked by the following:
ihex_write_at_address(&state, 0xFFF0);
ihex_write_bytes(&state, dataBuffer, 0x10);
ihex_write_at_address(&state, 0x10000);
ihex_write_bytes(&state, dataBuffer, 0x10);
The problem is in the ihex_write_at_address() function. It will flush the previous existing data, then compare the ihex->address upper bytes to the new requested address upperbytes. Both are now the same, since ihex_write_data() has incremented ihex->address.
Would this be an acceptable change:
void
ihex_write_at_address (struct ihex_state *ihex, ihex_address_t address) {
if (ihex->length) {
// flush any existing data
ihex_write_data(ihex);
}
if (((ihex->address & ADDRESS_HIGH_MASK) != (address & ADDRESS_HIGH_MASK)) ||
(ihex->address == (address & ADDRESS_HIGH_MASK)) ){
ihex->flags |= IHEX_FLAG_ADDRESS_OVERFLOW;
} else {
ihex->flags &= ~IHEX_FLAG_ADDRESS_OVERFLOW;
}
ihex->address = address;
ihex_set_output_line_length(ihex, ihex->line_length);
}
Here, we also check for the boundary condition where the ihex->address is the boundary address of the 64kB block of addresses we are changing to.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.