Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

About AVR8 IJMP instruction

2 posters

Go down  Message [Page 1 of 1]

1About AVR8 IJMP instruction Empty About AVR8 IJMP instruction Fri May 05, 2023 4:58 pm

KerimF

KerimF

SimulIDE-R1657_Win32
In brief, the IJMP instruction of AVR8 (AVRasm2) doesn’t jump to the indirect address saved in ZH:ZL.
Instead, it skips the next instruction which is usually an RJMP instruction among many RJMPs in a table. The cursor moves directly to the function pointed by the RJMP.
The real problem is that executing IJMP may also skip the function of interest (pointed to by RJMP). In this case (for example, skipping the function SCRNmod: in the attached code), the cursor returns to the beginning of the main loop (MAIN_lp:).

About AVR8 IJMP instruction Avdc_010

Note:
This project is in progress. It is about an Ampere-Hour (AH) meter, besides being a DC (average) voltage and current meter, for charging/discharging an acid battery.
Attachments
About AVR8 IJMP instruction AttachmentAVDC_07_04bT_asm_sim.zip
You don't have permission to download attachments.
(27 Kb) Downloaded 3 times
About AVR8 IJMP instruction AttachmentAVDC_07_04bT_lst.zip
You don't have permission to download attachments.
(35 Kb) Downloaded 3 times

2About AVR8 IJMP instruction Empty Re: About AVR8 IJMP instruction Fri May 05, 2023 5:35 pm

arcachofo

arcachofo

Thanks, I will have a look.

3About AVR8 IJMP instruction Empty Re: About AVR8 IJMP instruction Sat May 06, 2023 2:03 pm

arcachofo

arcachofo

In brief, the IJMP instruction of AVR8 (AVRasm2) doesn’t jump to the indirect address saved in ZH:ZL.
Instead, it skips the next instruction which is usually an RJMP instruction among many RJMPs in a table. The cursor moves directly to the function pointed by the RJMP.
IJMP looks to be be working correctly.
If the cursor moves to the function pointed by the RJMP, then RJPM was executed, and jumping to this RJPM is what IJMP  is doing.

What seems to happen is that the debugger is not stopping at those lines.
For some reason many asm lines are not mapped to PGM addresses.

For me it is only mapping 718 lines:
"Mapping Flash to Source... 718 lines mapped"

Lines mapped to PGM are indicated with a darker grey, and there are many not mapped, for example:

About AVR8 IJMP instruction Kk19

4About AVR8 IJMP instruction Empty Re: About AVR8 IJMP instruction Sat May 06, 2023 2:19 pm

arcachofo

arcachofo

Seems that the problem is caused by conditional compiling.

5About AVR8 IJMP instruction Empty Re: About AVR8 IJMP instruction Sat May 06, 2023 3:28 pm

KerimF

KerimF

arcachofo wrote:Seems that the problem is caused by conditional compiling.

It happens that, today only (while I was debugging using SimulIDE_1.0.1-R1386_Win32), I knew the meaning of these darker squares. I noticed that the cursor stepped to a blanked line right after the instruction line on which it was supposed to stop. The cause was the blanked line which is before (above) that instruction. Actually, it wasn't empty. It has a few spaces (which are invisible). When I cleaned (removed) these spaces and re-compile, the darker squares re-aligned correctly.

For avoiding this in the future, I will clean first the code text from extra spaces by using 'Crimson Editor' which I downloaded since long.

Now, I will try to find out the reason for which not all lines are mapped properly by reducing, step by step and in different ways, the conditional directives (which I usually use a lot).

6About AVR8 IJMP instruction Empty Re: About AVR8 IJMP instruction Sat May 06, 2023 5:08 pm

KerimF

KerimF

KerimF wrote:
arcachofo wrote:Seems that the problem is caused by conditional compiling.

Now, I will try to find out the reason for which not all lines are mapped properly by reducing, step by step and in different ways, the conditional directives (which I usually use a lot).

SimulIDE-R1657_Win32

About the red mark, it is actually orange (when I looked at it closely). And, as you said, it is located where the warnings are (so, I guess, it is formed by many thin lines which are very close to each other, as the lines of the warnings are).

Then, after commenting out a couple of blocks (using /* and */) where the instruction lines started missing the darker squares, the remaining code lines were also mapped correctly. And IJMP jumped to the RJMPs table (nothing skipped).

Case is solved Smile

arcachofo likes this post

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum