NotePad++ Arduino compile & upload without IDE - Page 1
Forum section: electronics / general

author: IanJ
author_rank: Unknown
timestamp: January 02, 2020, 07:25:32 pm
content: Hi all,I have been using Notepad++ as an external editor for Arduino since day 1 (many years ago!) and recently got around to playing with the use of the arduino Console app (arduino_debug.exe) located in the Arduino app main folder, and also the NppExec plugin.I thought I'd share my configuration as I find it extremely useful in allowing me to compile & upload my sketches to my boards without ever opening the Arduino IDE. In other words I open my sketch in Notepad++ and when I am ready hit F6 and select my script and the sketch will compile and be send to the board, visible also via the Notepad++ Console that appears.INSTALL:-To install the NppExec choose Plugins => Plugin Manager => Show Plugin Manager. Check the box for NppExec and click Install, and let Notepad++ restart itself.NPPEXEC CONFIG:-I have a few script loaded, and simply select one from a pull down on hitting F6. Here are the individual scripts and the names I've given them.ATMEGA1284 Compileset arduino_path = "C:\Program Files (x86)\Arduino-1.8.9\arduino_debug"cmd /c $(arduino_path) --verbose-build --board IanJ_1284:avr:IanJ_1284 --verify $(FULL_CURRENT_PATH)ATMEGA1284 Compile & Uploadset arduino_path = "C:\Program Files (x86)\Arduino-1.8.9\arduino_debug"cmd /c $(arduino_path) --verbose-build --board IanJ_1284:avr:IanJ_1284 --useprogrammer --verbose-upload --upload $(full_current_path)STM32F103C8 Compileset arduino_path = "C:\Program Files (x86)\Arduino-1.8.9\arduino_debug"cmd /c $(arduino_path) --verbose-build --board stm32duino:STM32F1:genericSTM32F103C:device_variant=STM32F103CB --verify $(FULL_CURRENT_PATH)STM32F103C8 Compile & Uploadset arduino_path = "C:\Program Files (x86)\Arduino-1.8.9\arduino_debug"cmd /c $(arduino_path) --verbose-build --board stm32duino:STM32F1:genericSTM32F103C:device_variant=STM32F103CB --verbose-upload --upload $(full_current_path)STM32L152RE Compile & Uploadset arduino_path = "C:\Program Files (x86)\Arduino-1.8.9\arduino_debug"cmd /c $(arduino_path) --verbose-build --board STM32:stm32:Nucleo_64 --verbose-upload --upload $(full_current_path)The only downside I have so far is that unlike the Arduino IDE there is no cacheing ability so everytime you compile it's a full compile.....albeit I haven't looked into this too much yet.If you want to create your own scripts, then pay attention to the line containing -FQBN when compiling & uploading using the Arduino IDE.Have fun,Ian.

author: rstofer
author_rank: Super Contributor
timestamp: January 02, 2020, 08:26:45 pm
content: Could you use 'make' and a Makefile? Do all the necessary scripting inside the Makefile...

author: Whales
author_rank: Super Contributor
timestamp: January 02, 2020, 08:32:50 pm
content: I prefer to think of Makefiles as a concept rather than an exact implementation. As such, these are short makefile entries put into the editor config rather than project files."Couldn't you..." can be said for anything. In this circumstance I would suggest adding the compile/test/program snippets to a readme rather than a script because the arduino_debug path will not always be the same, esp non non-windows platforms.Thankyou for sharing IanJ. I used to use some 3rd party arduino CLI tools so I could avoid the official Arduino editor. This looks like it might be a simpler & more portable option.

author: Veteran68
author_rank: Frequent Contributor
timestamp: January 02, 2020, 09:55:59 pm
content: I used to be a Notepad++ user years ago, but fell in love with Sublime Text then Visual Studio Code. A lot of Arduino projects are transitioning to using the PlatformIO platform on VSCode. I'm loving it, you get advanced IDE-type features of a real programmer's editor that is light years better than Npp. Including support for hardware debugging.

author: westfw
author_rank: Super Contributor
timestamp: January 03, 2020, 01:35:41 am
content: There's a whole "arduino_cli" that is designed for this. I *think* it's significantly different than using arduino_debug?https://github.com/arduino/arduino-cli

author: JustMeHere
author_rank: Frequent Contributor
timestamp: January 03, 2020, 02:53:33 am
content: Here's the home of Avrdude.https://savannah.nongnu.org/projects/avrdude

author: IanJ
author_rank: Unknown
timestamp: January 03, 2020, 04:40:48 pm
content: Quote from: Veteran68 on January 02, 2020, 09:55:59 pmI have played with a few apps, VSCode/PlatformIO being the latest but got put off because I couldn't find an easy way to make the default project dir another location on my PC. Why on earth you are not given the choice during install beats me!I have also played with VisualGDB, VisualMicro, Eclipse etc.......but always end up back with NPP/Arduino IDE. What I want is an easy install, easy configure, easy integration of my existing Arduino Libraries (some downloaded, some home made), easy backed up/re-installed...........To date I have never found this, I either have to jump through loads of hoops, some libraries no longer work, or there is some other fundemental issue that stops me from using it.Ian.

author: Veteran68
author_rank: Frequent Contributor
timestamp: January 03, 2020, 09:32:04 pm
content: Quote from: IanJ on January 03, 2020, 04:40:48 pmI've been a Software Engineer for 30+ years now, starting out with firmware/driver level coding for mainframe terminal emulator cards in the mid-80's. Brief and Multi-Edit were my editors of choice then for C/C++ and ASM coding. Nowadays I'm more on the enterprise architecture side and manage teams of engineers rather than do the heavy lifting myself, but I still love it and always have little projects going on.For years I was a Java developer and love Eclipse for that. I also dabbled in Eclipse for C/C++ and started looking at for micro development but didn't get far. Arduino IDE just hurts me to use, LOL. I've been a Sublime Text users for years, but VSCode has come along and eclipsed (no pun intended) it for almost everything. It's now my go-to for pretty much all things coding. I played with early versions of PlatformIO and another other Arduino plugin and they were cumbersome and non-intuitive to use, so I stuck with Arduino IDE for micro work. Now however PlatformIO has matured and released for free what used to cost money, things like their hardware debugger support. Now I love it and can't see ever using Arduino IDE again unless I absolutely have to.I will admit though, for someone who's not a professional developer, Arduino IDE is easy to get going with quickly and definitely has its place.

author: rstofer
author_rank: Super Contributor
timestamp: January 03, 2020, 10:43:24 pm
content: Quote from: Veteran68 on January 02, 2020, 09:55:59 pmExcept for the fact that VS Code has no printing capability whatsoever. I just used it for a rather large FPGA tutorial and I like the editor but not being able to print my source is a PITA.

author: Veteran68
author_rank: Frequent Contributor
timestamp: January 03, 2020, 11:26:39 pm
content: Quote from: rstofer on January 03, 2020, 10:43:24 pmNor does Sublime Text, nor probably most modern programmer's editors nowadays, at least out of the box. Printing of source code is something developers rarely do these days. Gone are the days of pouring over 2 inch thick greenbar printouts, and I don't miss it LOL. I do have Npp for when I need to print a text file, but no more often than I print the easiest thing to do is just copy/paste into the nearest Notepad, Word, Google Docs, etc. and print it from there. If I need pretty print I use a plugin that copies as RTF or HTML and open it in the browser to print.That said, plugins are available for VSCode and others, such asPrintCode, if that functionality is really important to you.

author: Mechatrommer
author_rank: Super Contributor
timestamp: January 04, 2020, 06:29:56 am
content: Quote from: IanJ on January 02, 2020, 07:25:32 pmarduino ide will always do full compile without caching (from the feeling of it) its so darn slow (i suspect your workchain too) i try to get rid of it arduino the ide and its toolchain when possible. if i dont have a dependency to arduino ide library, i always use avr studio (blazing speed compilation compared to arduino ide), grab the compiled hex and feed to avrdude to transfer to arduino the board. ymmv.

author: IanJ
author_rank: Unknown
timestamp: January 04, 2020, 06:46:25 am
content: Quote from: Mechatrommer on January 04, 2020, 06:29:56 amMy code is quite big so it's really noticeable, first time after booting the IDE it may take 15secs, and there after about 5secs.The console also reports about using pre-compiled sections, I forget the exact messages but perhaps it's the libraries.......Ian.

author: Mechatrommer
author_rank: Super Contributor
timestamp: January 04, 2020, 07:43:01 am
content: whenever i have to modify my 3d printer reprap marlin code, inevitably i have to compile in arduino IDE. i have to do some stretching or go out to see the grass if i dont want to get mad waiting for the compilation to complete, everytime! even if i change one character in the code a minute later.

author: IanJ
author_rank: Unknown
timestamp: January 04, 2020, 12:36:33 pm
content: Arduino IDE (1.8.9) compilation test.STM32L152RE4 libraries loaded including U8g2lib, TimedAction, SPI & EEprom.First time after booting the IDE =1min 02secs2nd time (no code change) =15secs3rd (code change - added a flip LED sub, see below) =15secsThe console reports many lines similar to these:-Using cached library dependencies for file: C:\Users\***\Documents\Arduino\libraries\U8g2\src\clib\u8x8_message.cUsing previously compiled file: C:\Users\***\AppData\Local\Temp\arduino_build_301421\libraries\TimedAction\TimedAction.cpp.oTest code added:-// TEST ONLYif ( flipled == 0 ) {digitalWrite(PC13LED_PIN,HIGH); // PC13 LED on} else {digitalWrite(PC13LED_PIN,LOW); // PC13 LED off}flipled = !flipled;For info:Sketch uses 74344 bytes (14%) of program storage space. Maximum is 524288 bytes.Global variables use 4184 bytes (5%) of dynamic memory, leaving 77736 bytes for local variables. Maximum is 81920 bytes.PC:-Core i7-8700K @ 3.7GHz, 32GB ramEDIT:After looking a bit more into this it looks like when you first compile after loading the IDE it creates a folder:C:\Users\***\AppData\Local\Temp\arduino_build_301421And this folder and it's contents exist until the IDE is closed.So, any subsequent compiles will use the contents of this folder (pre-compiled libs etc) rather than compile from scratch.The number in the folder name i.e. 301421 is an example and changes each time the IDE is opened and compilation is run for the 1st time.At the moment I can't see a way of replicating this via arduino_debug (see post #1).Ian.