Menu

Need help setting up SimulIDE for avr-gcc on Linux

Help
2018-09-07
2018-09-09
  • Least Significant Bit

    First of all: thanks to everyone involved in this project! I've been struggling with SimulAVR and SimAVR on the command line (SimulAVR seems to be abandoned), and Atmel Studio 6 in a Windows XP(!) virtual machine, but it's clunky and can only simulate standalone MCUs. I've been dreaming about an "IDE" that would allow me to build and test simple AVR projects including external components such as buttons, LEDs and serial comms, and to be able to watch and graph pins and registers in realtime. There is Proteus SVM of course, but as I'm basically a "hobbyist" when it comes to electronics design, it's impossible to justify the high cost. It is also a Windows only application, and I'm a staunch Linux geek :) So it is very welcome to see such a mature and full-featured open source project which does exactly what I was dreaming about! It even has a name that doesn't make me cringe, which is a rare thing indeed. Amazing!

    Since I like living on the edge, I checked out the SVN trunk and managed to get it to build after installing some additional Qt5 libs (I also had to add some dummy files for three missing PNG icons), and the application and examples run very well. So far I'm quite impressed! But I'm wondering how one goes about integrating the avr-gcc compiler? The examples on the official site only mention Arduino, GcBasic (whassat?) and Assembler... I've got the AVR GCC toolchain installed, and I can compile AVR C apps with e.g. avr-gcc -g -O2 -mmcu=attiny2313 -o test.elf test.c Is it possible to do this from within SimulIDE?

    Edit: In case any devs want to know, the three missing icons are cdup.png, powerdeb.png
    and runtobk.png in /src/icons/mainwindow/

     

    Last edit: Least Significant Bit 2018-09-07
  • Santiago

    Santiago - 2018-09-07

    Hi. Glad to know you find simulide useful.

    You can compile any makefile based project in simulide, just open the makefile and compile, then open hex file in editor and upload to an mcu in the circuit or load hex directly from the mcu.

    So an option is creating a simple makefile for your project.

    Thanks for reporting the missing icons issue.

     
  • Least Significant Bit

    Hi Santiago! Thanks for your help - it works! But I found that I have to name it "Makefile", and not "makefile", or I get "File type not supported" ("make" itself does not care about this). But the built-in compilation function is not that useful; you still have to manually load the resulting .hex file, and you can't trigger a compilation from the .c file itself. It would be cool if the app knew what source code was running on the MCU, so you could do single click deployment directly from the .c source (i.e. a "Deploy" button). Then again, it's not much hassle to switch between a separate editor, the command line and SimulIDE, and it's probably not worth spending developer time on replicating functionality already provided by whatever tools people are used to using for coding and compiling. I'm a big fan of SublimeText personally, and it seems unlikely that SimulIDE could ever replace it - in fact I think you'd be wasting your time even trying. Better to concentrate on bugfixing what's already there (and it's a lot!) - I do get far too many segfaults as it is; often when doing basic things like dragging a wire. I've also noticed that the drag/move functionality often stops working altogether, possibly after my laptop has been suspended, necessitating a restart of the application to recover.

    Edit: Here's my Makefile, in case anyone finds it useful - it's very generic; you just need to change "APP" to your project name and set the MCU and FREQ:

    CC      = avr-gcc
    OBJCOPY = avr-objcopy
    MCU     = attiny84
    FREQ    = 16000000
    APP     = first_attempt
    CFLAGS  = -O2 -I. -mmcu=${MCU} -DF_CPU=${FREQ}UL
    
    ${APP}.hex: ${APP}.elf
        ${OBJCOPY} -j .text -j .data -O ihex $< $@
    
    ${APP}.elf: ${APP}.o
        ${CC} -o $@ $^
    
    clean:
        rm -f ${APP}.elf ${APP}.hex ${APP}.o
    

    Edit 2: No, it's not "suspend" that causes drag/move to stop working; it will happen even without the machine going to sleep.

     

    Last edit: Least Significant Bit 2018-09-09
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.