Bug 1083957 - gpsim is fundamentally broken
Summary: gpsim is fundamentally broken
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gpsim
Version: 20
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Roy Rankin
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-03 10:05 UTC by Neil Darlow
Modified: 2015-06-30 00:58 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-06-30 00:58:19 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Sequence of gpsim invokations as typescript and source files (2.20 KB, application/x-gzip)
2014-04-05 09:40 UTC, Neil Darlow
no flags Details

Description Neil Darlow 2014-04-03 10:05:41 UTC
Description of problem:
gpsim command line option processing is broken and attempting to open a file from the GUI fails.

Version-Release number of selected component (if applicable):
gpsim-0.27.0-1.fc20.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. Try invoking command line mode with -i or --cli option. An error results.
2. Try opening a .cod file in GUI with File|Open... An error results.
3. Try setting the cpu frequency. It always reports the cpu is not set.
4. Try setting the cpu. It appears to work but subsequent operations fail.

Actual results:
The package displays numerous breakages.

Expected results:


Additional info:

Comment 1 Roy Rankin 2014-04-05 00:25:14 UTC
Neil,

Thanks for the bug report. However, the more details you can give the better.
As an example, when you say "An error results" give the error message or describe what happens. It is also helpful if you give the exact commands used. 

1. The -i option is used successfully in the developers regression tests, but I notice it is not documented properly and the command "gpsim -i" does give the message " -i: No such file or directory"; although I can still load and run the program from the gpsim command line when this happens. I will raise an upstream bug report on this.

2. This works for me, please give more details. where did the .cod file come from?

3. There are a number of ways to set the CPU frequency, please explain precisely
    how you started gpsim and how you are setting the frequency.

4. Again more details are required including what subsequent operations fail.

Regards,
Roy Rankin

Comment 2 Neil Darlow 2014-04-05 09:40:16 UTC
Created attachment 883004 [details]
Sequence of gpsim invokations as typescript and source files

An archive containing source files .asm, .cod, .hex (originally generated by the JALv2 compiler) and a typescript file showing attempts at getting gpsim to load those files.

The gpsim responses seem to indicate that the processor is not being set although it has been specified several ways. In fact, one response shows the command line set processor is being ignored because the .cod file specifies it then it goes on to say that the processor is not set afterwards.

The non-gui switch solicits an error when you attempt to start gpsim without gui and then the gui is shown regardless.

Comment 3 Roy Rankin 2014-04-05 23:05:05 UTC
Neil,

The biggest problem is that gpsim cannot load your .cod file. If I assemble main.asm using gpasm from the gputils package, the resulting .cod file loads as expected. However, gpsim gives an error when the program tries to run the instruction to load trise with 0xf8. I can run the .hex file with either "gpsim -p p18f4520 main.hex" or "gpsim -i -p p18f4520 main.hex", but then the source window in gpsim does not work.

I know you are trying different things, but you either load the .cod file or the .hex file but not both. And by design the -p option does not work when loading a .cod file.

From the tracescript, I cannot tell which case the gui starts up on when --cli flag is set.

Comment 4 Neil Darlow 2014-04-06 07:42:06 UTC
Roy,

Thanks for finding this.

Assembling the file with gpasm does indeed allow the file to load and I can execute the instruction you had problems (the code is actually written for a PIC18F4550 but that's not directly supported by gpsim yet. The PIC18F4520 was a fudge and there may be better alternatives).

Regarding the --gui flag, it appears something is broken there. Use of -i does disable the gui but --gui does not (this is for a case of gpsim --gui main.cod).

I will point the JALV2 author to this bug report and see what he says.

Regards,
Neil Darlow

Comment 5 Roy Rankin 2014-04-07 13:00:26 UTC
Neil,

I assume you mean --cli when you say --gui. I took your typescript file and grepped out the gpsim commands into a file and ran these. I found the -i was handled correctly but the --cli was not (ie the gui ran). Investigation found that the typescript file has \r\n at the end of each line and this is confusing the option processing functions (popt) used by gpsim. Could a \r\n at the end of the command explain what you are seeing?

As a gpsim co-developer I am working on a patch to fix the option handling issues you have raised including the above.

I have taken a second look at the JALV2 .cod issue. When gpsim loads a .cod file it needs a .lst to determine the processor type and loads it along with the .asm file for the source window. Using the .lst file generated by gpasm allowed me to load the JALV2 .cod file, but the .asm file is not shown in the source window.

Gpsim can run the .hex file from JALV2 with the command "gpsim -p p18f4520 main.hex" but the gpsim source browser window will not work with a hex file.

Finally, once gpsim properly loads code, you should find the cpu frequency is displayable and settable in tge gpsim command line interface. 

Regards,
Roy Rankin

Comment 6 Neil Darlow 2014-04-07 16:19:59 UTC
Hi Roy,

Yes, I meant --cli.

I don't see why my terminal session should generate \r\n sequences although I did notice that gpsim's output does include them. Perhaps you are seeing a \r\n output by gpsim in response to it exhausting the input buffer on reading?

Regarding the .lst file requirement, I was not aware of that. I thought, wrongly, that gpsim parsed the LIST p=... directive from the .asm file. It would certainly explain why the processor type was failing to be set.

The JALv2 developer noted a few differences in his .cod file specification and that of MPLAB (and presumably gputils) which might have a bearing on this problem but your inference that a .lst file is also required explains things better.

Making option parsing more robust is probably a good idea but I doubt it will improve the usefulness of gpsim in this particular case.

I have put forward the suggestion that JAL, in a future incarnation, might be better served by allowing an external toolchain to generate code. That way the compatibility between compiler and debugger would be assured.

In the meantime I am assessing better options for my embedded PIC programming on Linux that will still allow me to debug at source level with gpsim.

Regards,
Neil Darlow

Comment 7 Fedora End Of Life 2015-05-29 11:26:49 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Fedora End Of Life 2015-06-30 00:58:19 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.