diff options
author | Roland Lutz <rlutz@hedmen.org> | 2017-07-11 18:17:56 +0200 |
---|---|---|
committer | Roland Lutz <rlutz@hedmen.org> | 2017-09-04 20:10:26 +0200 |
commit | a96d1fffdc371bad3bc81172d8663e0a5a902945 (patch) | |
tree | 10b97ee11708c205b5dd91703d58f157a5f54b82 | |
parent | b7a6785b88e5f7f7ffa715424b4ec5a1dbc432ce (diff) | |
download | icestorm-a96d1fffdc371bad3bc81172d8663e0a5a902945.tar.gz icestorm-a96d1fffdc371bad3bc81172d8663e0a5a902945.tar.bz2 icestorm-a96d1fffdc371bad3bc81172d8663e0a5a902945.zip |
icemulti: Store image reference in header
-rw-r--r-- | icemulti/icemulti.cc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/icemulti/icemulti.cc b/icemulti/icemulti.cc index 45e53c1..143d0d9 100644 --- a/icemulti/icemulti.cc +++ b/icemulti/icemulti.cc @@ -122,11 +122,8 @@ void Image::write(std::ostream &ofs, uint32_t &file_offset) } class Header { - uint32_t image_offs; public: - Header() {} - Header(const Image &i) : - image_offs(i.offset()) {} + Image const *image; void write(std::ostream &ofs, uint32_t &file_offset, bool coldboot); }; @@ -146,9 +143,9 @@ void Header::write(std::ostream &ofs, uint32_t &file_offset, bool coldboot) // Boot address write_byte(ofs, file_offset, 0x44); write_byte(ofs, file_offset, 0x03); - write_byte(ofs, file_offset, (image_offs >> 16) & 0xff); - write_byte(ofs, file_offset, (image_offs >> 8) & 0xff); - write_byte(ofs, file_offset, image_offs & 0xff); + write_byte(ofs, file_offset, (image->offset() >> 16) & 0xff); + write_byte(ofs, file_offset, (image->offset() >> 8) & 0xff); + write_byte(ofs, file_offset, image->offset() & 0xff); // Bank offset write_byte(ofs, file_offset, 0x82); @@ -278,10 +275,10 @@ int main(int argc, char **argv) // Populate headers for (int i=0; i<image_count; i++) - headers[i + 1] = Header(*images[i]); - headers[0] = headers[por_image + 1]; + headers[i + 1].image = &*images[i]; + headers[0].image = headers[por_image + 1].image; for (int i=image_count; i < NUM_IMAGES; i++) - headers[i + 1] = headers[0]; + headers[i + 1].image = headers[0].image; std::ofstream ofs; std::ostream *osp; |