You need to log in to create posts and topics.

Cooperation with an external editor and debugger (e.g. Platformio)

Page 1 of 3Next

Dear Simulide developers,

First of all, I would like to thank you for such a great application and the time you spent developing it. Simulide has saved me a lot of time wiring real hardware and uploading firmware to real mcu. So - THANK YOU VERY MUCH!

During the development of my Adruino projects I used Simulide as a simulator of my circuits connected to the mcu loaded by a compiled binary. For code development and binary compilation I used Platformio + VSCodium, which is a very popular tool today and you probably know or have heard of it. In particular, VSCodium (or VSCode) provides an advanced code editor with code completion and debugging capabilities.

At a certain stage in the development of a project, I needed to debug the code while running a simulation. I am aware that Simulide offers such an option via an integrated editor. However, I was not able to transfer my code sources and libraries to the Arduino file layout to compile and debug them in Simulide. This is where my idea for improvement or feature request comes from: Would it be possible to run Simulide as an mcu (+circuits) simulator and debug the code in an external editor? This would probably require sharing and setting up the same port for simulator and debugger, and maybe other things I am not aware of.

In my opinion such a feature would take the Simulide to another level. I am not an expert but I think that such an option would not be that complicated to achieve.

Thank you for considering my idea!

Best regards, Jozef

Hi, thank you for your kind words.

What you suggest would be great, but I don't think it is so easy.
If you know a simple way to implement this please let me know.

Thank you very much for your reply. Unfortunately I have no idea how complicated this can be. But at least and as a first approximation it would be nice to make it operational with some avr-gdb gui frontend. For example, here it is shown how to debug code using seergdb and simavr. I imagine that Simulide could somehow be replaced by simavr program here. By the way, is Simulide based on simavr?

Best regards, J.

No, Simulide is not based on Simavr anymore (it was in versions 0.x.x).
And there is no gdb in Simulide now, it uses it's own simple debugger.

I have been thinking about this... it might be possible to debug code compiled externally in Simulide, but not debug from an external application.

I see, in that case it can get really complicated. I was convinced that simulide uses simavr and avr-gdb...

But anyway, your last hint would be a big step forward: develop a project code and compile it in e.g. VSCode + Platformio and then debug in Simulide (just by providing paths to hex and elf files).

Regards, J.

 

 

But anyway, your last hint would be a big step forward: develop a project code and compile it in e.g. VSCode + Platformio and then debug in Simulide (just by providing paths to hex and elf files).

We need a .lst file for Simulide.
Not sure if your setup generates  a .lst file, but probably it can be configured to do so.

I can try to debug in Simulide if you provide a simple project, for example a blinking led.
Just zip the whole thing and attach here.

Ok, I have tried to configure a simple pio project to provide an lst file (I hope this is the right one).

The lst, hex and elf files are in the hidden directory: .pio/build/nanoatmega328 in the attached zip.

I hope you will be able to debug it.

PS: I am unsure if the zip is uploaded. If not, it should be here.

 

 

Thanks, I will have a look.

Seems that the .lst file does contain information about the asm code.
Ussually it has someting similar to this:

            323 ;	/home/mc551-sdcc/ledblink.c:9: while(1)
  000000        324 00102$:
            325 ;	/home/mc551-sdcc/ledblink.c:11: P1 = 0xFF;
  000000 75 90 FF     [24]  326 	mov	_P1,#0xff
            327 ;	/home/mc551-sdcc/ledblink.c:12: delay();
  000003 12r00r0E     [24]  328 	lcall	_delay
            329 ;	/home/mc551-sdcc/ledblink.c:13: P1 = 0x00;
  000006 75 90 00     [24]  330 	mov	_P1,#0x00
            331 ;	/home/mc551-sdcc/ledblink.c:14: delay();
  000009 12r00r0E     [24]  332 	lcall	_delay
            333 ;	/home/mc551-sdcc/ledblink.c:16: }
  00000C 80 F2    [24]  334 	sjmp	00102$

There is probably some option to include that info in the .lst file.
But I'm not optimistic with Hi-Tech compiler, indeed I remember we tried it sometime ago and didn't work... isn't it?

To create the lst file I used avr-toochain 7.3.0 (from 2017), which should be a version that comes with the arduino ide. However, there are many options to generate the assembly. What are the options/parameters to generate the lst file in Simulide with avr-toochain? I must be somewhere in the code... If I know them, I can set my compiler to provide the correct lst.

Page 1 of 3Next