My original post seems to have gone missing so here it is ....
I have a project consisting of 2 .asm files, the code is relocatable.
If I select main.asm source and click the build button, I get the following errors
/home/mikee/gooligum/Projects/blink/main.asm:29:Error[181] Unknown opcode: "#"
/home/mikee/gooligum/Projects/blink/main.asm:31:Error[149] Directive only allowed when generating an object file: "EXTERN"
/home/mikee/gooligum/Projects/blink/main.asm:40:Error[149] Directive only allowed when generating an object file: "UDATA_SHR"
/home/mikee/gooligum/Projects/blink/main.asm:45:Error[149] Directive only allowed when generating an object file: "CODE"
/home/mikee/gooligum/Projects/blink/main.asm:50:Error[149] Directive only allowed when generating an object file: "CODE"
/home/mikee/gooligum/Projects/blink/main.asm:57:Error[113] Symbol not previously defined: "delay10_R"
/home/mikee/gooligum/Projects/blink/main.asm:58:Error[113] Symbol not previously defined: "delay10_R"
/home/mikee/gooligum/Projects/blink/main.asm:62:Error[149] Directive only allowed when generating an object file: "CODE"
Error[181] Error generating hex file.
ERROR!!! Compilation Faliled
So I created a make file after reading that Sumulide understands these ...
And can now build and run the simulation by selecting the Makefile and clicking the compile (checkmark) button.
The problem arises when I want to debug the code, if I click on the Makefile and hit the debug button I get the error
Starting Debbuger...
Error:NoDebuggerSuitedforthisFile...
Debbuger Stopped
If I select main.asm and click debug, I get the original error.
Is there a way to build and debug relocatable code in Sumulide ?
Thanks for any help,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous posts are allowed but need to be approbed, that's why your first post doesn't show.
At the moment there is no way to debug makefile based projects in simulide.
But just simulating the circuit you can use RamTable to watch registers.
But there is a trick that might work to debug your project (not tested):
For this trick to work original gpasm must be in path.
Create an script to compile.
Save it in some folder out of path with name "gpasm".
Choose this folder as compilder path.
When you press compile or debug button, the project will compile from this script and debugger should work now (not sure how debugger will work with relocatable code).
Note that .asm file path is passed to the script as $5
As an example this is a generic script that takes all .asm files, compiles and link all .o :
#!/bin/bash# Save me as "gpasm" out of path so it doesn't override original gpasm# Choose folder containing this file as pic-asm compiler path in simulideasmFile=$5hexFile=${asmFile/%.asm/.hex}projectFolder=${asmFile%\/*.asm}echo"projectFolder: "$projectFoldercd$projectFolderecho" "forsource in *.asm;doecho gpasm -c -L -w1 -i -ainhx32 $source
gpasm -c -L -w1 -i -ainhx32 $sourcedoneecho" "objects=" "for object in *.o;doobjects=$objects" "$objectdoneecho gplink --map -c -o $hexFile$objects
gplink --map -c -o $hexFile$objects
You could also "cd" to project folder and run "make" using your makefile.
In any case if you attach your files here i can test it and find solutions.
Thanks for reporting.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for taking the time to answer my question, I will take a look at this when I get a chance.
In the mean time, keep up the great work, from my experience, Simulide is best in its class of approchable PIC simulators for hobbyists like me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am able to build all the appropriate files with make, I can load the firmware into the device using simulide, the question remains how do I persuade it to debug my code and allow me to step using the source view? Is there a file I need to select before I click the debug button?
Perhaps there could be an option to start debugging without trying to build anything first?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To start de debugger, the file opened in editor must be the asm file you want to debug, it must be compiled and uploaded to a chip in the circuit and it must be a .lst file with same name than asm file generated in the same build.
You can compile from a makefile, but the debugger doesn't know wich is the source file to debug and wich kind of file it is, so it can't do nothing.
That's why i suggested you that trick:
You can open the main asm file, use the "fake" gpasm script to compile, then you can debug because it is a Pic asm file and it is compiled. I have not tried, maybe there are other problems, but at least you should be able to start debugger.
The example script is a general one, you can use it for several projects, but you could just copy/paste your build steps for your project and you don't need to build "manually" every time yo modify the sources.
"...start debugging without trying to build anything first?"
That could lead to many problems, because all files: .asm, .hex and .lst must be the correct ones.
What happens if you modify the asm file?
In any case you have to build, and i think is easier if you use an script and you just click "start debugger" every time you modify the sources, then the project will build, upload to mcu and start debugger, all from simulide.
The only problem i see is that at the moment the script must be named "gpasm", the solution could be allowing to use any other name.
Probably it would be useful some kind of "project" that includes, sources, circuit and setting like compiler and others...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My original post seems to have gone missing so here it is ....
I have a project consisting of 2 .asm files, the code is relocatable.
If I select main.asm source and click the build button, I get the following errors
Exec: gpasm -L -w1 -i -ainhx32 /home/mikee/gooligum/Projects/blink/main.asm
/home/mikee/gooligum/Projects/blink/main.asm:29:Error[181] Unknown opcode: "#"
/home/mikee/gooligum/Projects/blink/main.asm:31:Error[149] Directive only allowed when generating an object file: "EXTERN"
/home/mikee/gooligum/Projects/blink/main.asm:40:Error[149] Directive only allowed when generating an object file: "UDATA_SHR"
/home/mikee/gooligum/Projects/blink/main.asm:45:Error[149] Directive only allowed when generating an object file: "CODE"
/home/mikee/gooligum/Projects/blink/main.asm:50:Error[149] Directive only allowed when generating an object file: "CODE"
/home/mikee/gooligum/Projects/blink/main.asm:57:Error[113] Symbol not previously defined: "delay10_R"
/home/mikee/gooligum/Projects/blink/main.asm:58:Error[113] Symbol not previously defined: "delay10_R"
/home/mikee/gooligum/Projects/blink/main.asm:62:Error[149] Directive only allowed when generating an object file: "CODE"
Error[181] Error generating hex file.
So I created a make file after reading that Sumulide understands these ...
OBJECTS = main.o delay.o
OUTPUT = main.hex
CCOPTS = -L -w1 -i -ainhx32
all: $(OUTPUT)
$(OUTPUT): $(OBJECTS)
gplink --map -c -o $(OUTPUT) $(OBJECTS)
%.o: %.asm
gpasm -c $(CCOPTS) $<
clean:
rm -f .o .lst .map .hex
delay.o: delay.asm
main.o: main.asm
And can now build and run the simulation by selecting the Makefile and clicking the compile (checkmark) button.
The problem arises when I want to debug the code, if I click on the Makefile and hit the debug button I get the error
Starting Debbuger...
Debbuger Stopped
If I select main.asm and click debug, I get the original error.
Is there a way to build and debug relocatable code in Sumulide ?
Thanks for any help,
Hi Mike.
Anonymous posts are allowed but need to be approbed, that's why your first post doesn't show.
At the moment there is no way to debug makefile based projects in simulide.
But just simulating the circuit you can use RamTable to watch registers.
But there is a trick that might work to debug your project (not tested):
For this trick to work original gpasm must be in path.
Create an script to compile.
Save it in some folder out of path with name "gpasm".
Choose this folder as compilder path.
When you press compile or debug button, the project will compile from this script and debugger should work now (not sure how debugger will work with relocatable code).
Note that .asm file path is passed to the script as $5
As an example this is a generic script that takes all .asm files, compiles and link all .o :
You could also "cd" to project folder and run "make" using your makefile.
In any case if you attach your files here i can test it and find solutions.
Thanks for reporting.
Thank you for taking the time to answer my question, I will take a look at this when I get a chance.
In the mean time, keep up the great work, from my experience, Simulide is best in its class of approchable PIC simulators for hobbyists like me.
Thanks to you for reporting.
I'm thinking in a better solution for this issue.
I am able to build all the appropriate files with make, I can load the firmware into the device using simulide, the question remains how do I persuade it to debug my code and allow me to step using the source view? Is there a file I need to select before I click the debug button?
Perhaps there could be an option to start debugging without trying to build anything first?
To start de debugger, the file opened in editor must be the asm file you want to debug, it must be compiled and uploaded to a chip in the circuit and it must be a .lst file with same name than asm file generated in the same build.
You can compile from a makefile, but the debugger doesn't know wich is the source file to debug and wich kind of file it is, so it can't do nothing.
That's why i suggested you that trick:
You can open the main asm file, use the "fake" gpasm script to compile, then you can debug because it is a Pic asm file and it is compiled. I have not tried, maybe there are other problems, but at least you should be able to start debugger.
The example script is a general one, you can use it for several projects, but you could just copy/paste your build steps for your project and you don't need to build "manually" every time yo modify the sources.
"...start debugging without trying to build anything first?"
That could lead to many problems, because all files: .asm, .hex and .lst must be the correct ones.
What happens if you modify the asm file?
In any case you have to build, and i think is easier if you use an script and you just click "start debugger" every time you modify the sources, then the project will build, upload to mcu and start debugger, all from simulide.
The only problem i see is that at the moment the script must be named "gpasm", the solution could be allowing to use any other name.
Probably it would be useful some kind of "project" that includes, sources, circuit and setting like compiler and others...