- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
we are using nios2-elf-objcopy.exe to produce hex file after building a project.
in ihex file 03 record, that points to program entry point, should be MSB. for example we are have 0x00020000 as base address of RAM. after project building process has complete we are call objcopy: nios2-elf-objcopy.exe -O ihex debug\project.elf project.hex program entry point is 0x0000201C8 (proofed in debugger and we are have boot address in another memory). objcopy it produce an ihex file and set program entry point with 03 record type to address 0x200001C8 this is produced string: :04000003200001C810 WHY??? it should be :04000003000201C82E does it bug in objcopy or in elf file?Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi m_fox,
> this is produced string: > :04000003200001C810 > > WHY??? Because it is the correct format for intel-hex. The address is specified as CS:IP (code segment register value:instruction pointer register value). Together they form a 20-bit segmented address. > it should be > :04000003000201C82E No, this would generate the linear address 000_01e8. The first two bytes "2000" represent bits [19:4], the second two are bits [16:0] ... the two values are added together in the proper bit positions. Basically, the correct values are added like this: 20000 (CS) 001c8 (IP) -------------- 201c8 (20-bit linear) > does it bug in objcopy or in elf file? No, it is not a bug. Regards, --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello,
thanks a lot for explain. so, in other words, to get linear address we are should do following calculations: :04000003XXXXYYYY (XXXX<<4) + YYYY is it correct? but it's funny, why objcopy sometimes generates records 05 and sometimes 03?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi m_fox,
> (XXXX<<4) + YYYY > > is it correct? Yes. > but it's funny, why objcopy sometimes generates records 05 and sometimes 03? I don't know why this happens -- record type 05 (start linear address) is certainly more appropriate for Nios (and virtually everything other than x86 in real mode). But from a practical point-of-view, it probably doesn't matter -- since device programmers don't use the start records. Regards, --Scott
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page