====== Toolchain NotePad++ IDE Setup ====== for MIOS application development on Windows \\ \\ **The technical jargon:**\\ This is the //NotePad++ IDE// section in a walkthrough on the process of developing [[MIOS]] Applications, on [[http://microsoft.com/windowsxp|Microsoft Windows XP]], primarily in C, utilising the [[http://www.ucapps.de/mios_c.html|MIOS C Wrapper]] [[how_to_mix_c_and_asm|but also in ASM]]. The IDE platform used will be [[http://www.codeblocks.org|Code::Blocks IDE]] or [[http://notepad-plus.sourceforge.net/uk/screenshots.php|NotePad++]] and the applications will be built for the [[home#mbhpmidibox_hardware_platform|MIDIBox Hardware Platform (MBHP)]] stuffed with a [[http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2042¶m=en020453&pageId=74|Microchip PIC18F]]. C code will be compiled with [[http://sourceforge.net/projects/sdcc|SDCC]], and assembled with [[http://sourceforge.net/projects/gputils|GPUtils]], using [[http://www.mingw.org/msys.shtml|MSYS]] to generate and run DOS-Console-based makefile scripts, and [[http://miosstudio.midibox.org|MIOS Studio]] will be used for debugging on MBHP. For PC emulation for debugging purposes, you may also use [[mios_c_simulator_-_debugger|AC-Sim (AudioCommander's CSimulator)]] compiled with [[http://gcc.gnu.org|GCC]] from [[http://www.mingw.org|MinGW]]. **Enough of that.**\\ You should have come here after the [[windows_toolchain_core|Core Tools]] setup. This part of the tutorial can actually be skipped completely if you wish. It contains setup instructions for an optional component of the toolchain. If you are going to be coding your apps in C or ASM or especially in both, then you only need to install this one last application, and your toolchain is complete. If you are not sure if this is you, then it isn’t.... Read on... You can always come back to this step later if you need to. \\ \\ ===== NotePad++ Installation ===== NotePad++ is really a text editor, not a full-blown IDE, but it contains all the required features for our use, and as it contains highlighting for both ASM and C apps, is perfectly suited to MIDIBox use. You can just install it using the defaults, but if you want to tweak it up good and proper, here's how. \\ * [[http://sourceforge.net/project/showfiles.php?group_id=95717&package_id=102072|Download the installer]]. You want the file named like npp.(version).Installer.exe [note:versions above 5.03 may not work with NPPExec or Explorer] * Run the installer. * Select your language, Click 'Next, 'I Agree', and 'Next'. * Tick the box labelled 'Don't use %APPDATA%.' * Expand the tree labelled 'Plugins' and untick the box labelled 'Light Explorer' (We'll install the full explorer plugin later) * Click 'Install' * When installation is complete, untick the box labelled 'Run NotePad++...' and click 'Finish'. ===== Tweaks ===== ==== Plugins ==== These plugins are not mandatory but can be helpful: * [[http://sourceforge.net/project/showfiles.php?group_id=189927&package_id=223668|Function List]] - Creates a list of functions for you to jump to in your source files * [[http://sourceforge.net/project/showfiles.php?group_id=189927&package_id=223667|Explorer plugin]] - A window pane with an explorer tree, which also includes a favourites list - very handy! * Download the dll files, and extract them to C:\Program Files\NotePad++\Plugins directory \\ ==== Style ==== If you like the colour scheme in this [[http://notepad-plus.sourceforge.net/commun/screenshots/scrsh_VibrantInk.png|screenshot]], you can download the [[http://notepad-plus.sourceforge.net/commun/misc/Port_VibrantInk.zip|Vibrant Ink]] style. I also recommend the use of the consolas font. * Download the file, and extract it to C:\Program Files\NotePad++\ . Overwrite any existing file. * Run NotePad++. Click the 'Settings... Styler Configurator' Menu. * Click the 'Default Style' and choose the programming font of your choice. I recommend consolas (11 point works well here but I zoom in and out a lot). You may like to see this forum thread: [[http://www.midibox.org/forum/index.php/topic,11096.0.html|Best Coding Font Ever]] * Select the "C" Language, and add user ext = "inc" (without the quotes) * Select the "Assembler" Language, and add user ext = "inc" (without the quotes) * Select the "Makefile" Language, and add user ext = "mk" (without the quotes) * To show the panes for your plugins, hit: * CTRL+ALT+SHIFT+V (Favourites) * CTRL+ALT+SHIFT+L (Function List) * CTRL+ALT+SHIFT+E (Explorer) * You can drag the functions list over to the left side to dock it as a tabbed pane with Explorer and Favourites. \\ ==== NPPExec Filters ==== In order to be able to double-click on an error and jump to that line (to fix your code) you need to tell NPPExec what the errors look like: * Hit SHIFT+F6 to bring up the NPPExec plugin filter dialog. Fill it in as per this screenshot: {{notepadplus:nppexec_filter.jpg}} * Change to the 'Highlight' Tab. Fill it in as per this screenshot: {{notepadplus:nppexec_highlight.jpg}} * Click OK For reference, here are the entries for you to copy and paste. You can enter them manually, or, you can paste all of this into your "C:\Program Files\Notepad++\plugins\Config\NppExec.ini" file: [Console] Visible=0 OEM=1 SaveOnExecute=0 CmdHistory=1 SaveCmdHistory=1 NoInternalMsgs=0 Font=F1F(6)0(18)90010(D)3020131436F6E736F6C61730(30) [ConsoleOutputFilter] Enable=1 RecognitionMask0="*%FILE%:%LINE%Error*" RecognitionEffect0="+E FF 00 00 -I +B -U" RecognitionMask1="*%FILE%:%LINE%: error*" RecognitionEffect1="+E FF 00 7F -I +B -U" RecognitionMask2="*%FILE%:%LINE%Warning*" RecognitionEffect2="+E FF 7F 00 -I -B -U" RecognitionMask3="*%FILE%:%LINE%: warning*" RecognitionEffect3="+E FF 7F 7F -I -B -U" ExcludeDupEmpty=1 ExcludeMask=1 ExcludeLine0="_output/*mios-gpasm-tmp.asm*Warning [231]*" [Restore] LastSelectedScript=2 \\ ==== NPPExec Execute Preset ==== This will give you a preset to run a cleanup from within NotePad++: * Hit F6 to bring up the NPPExec Execute dialog. * In the 'Commands' Textbox, type the following: '' cd $(CURRENT_DIRECTORY)\ \\ make cleanall '' * Click 'Save...', and type in a name like "MIOS clean" or something. This will give you a preset to run make from within NotePad++: * In the 'Commands' Textbox, type the following: '' cd $(CURRENT_DIRECTORY)\ \\ make '' * Click 'Save...', and type in a name like "MIOS make" or something. * Click 'Cancel' to exit (if you click OK, it'll run make!) Now, when you want to make the file, you can just hit F6, make sure the 'MIOS make' preset is selected, and then hit Enter, and make will be called in the directory of the currently open file.\\ Messages will be shown in the output window, which will open automatically. If there are any errors, you can double-click the error and jump to the offending code :) Have some eye candy: {{notepadplus:npp_in_action.jpg}} //Note for old projects (really, you should update your project for the new structure if possible):// This will give you a preset to run make.bat from within NotePad++: * Hit F6 to bring up the NPPExec Execute dialog. * In the 'Commands' Textbox, type the following: '' cd $(CURRENT_DIRECTORY)\ \\ make.bat '' * Click 'Save...', and type in a name like "MIOS make.bat" or something. * Click 'Cancel' to exit (if you click OK, it'll run make.bat!) \\ \\ ==== PIC ASM Highlighting ==== Copy and paste this code into a new file in your NotePad++ directory called C:\Program Files\Notepad++\userDefineLang.xml 000000 - ! % < = > 1 1 2 2 0; 0;; _boden_ _cp_ _pwrte_ _wdt_ _wrt_enable_ _osc _debug_ _cpd_ END expand extern local noexpand banksel bankidel global idata pagesel udata constant define end endc endm endif endw equ error errorlevel include #include #if #ifdef #ifndef #define #else #endif list messg nolist org page processor radix set space subtitle title undefine variable else if ifdef ifndef while addwf andwf btg clrf crlw clrc clrdc clrz cpfsgt cpfslt cpfseq comf decf decfsz incf incfsz iorwf movf movwf mullw nop rlf rrf subwf swapf tris xorwf bcf bsf btg btfsc btfss addlw andlw bra call clrwdt goto iorlw movlw rcall rgoto retfie retlw return sleep sublw subwf xorlw option addcf adddcf addwfc bc bdc bnc bndc bnz bz lcall lgoto movfw movff lfsr negf setc setdc setf setz skpc skpdc skpnc skpndc skpnz skpz subcf subdcf tstf indf pcl status fsr eecon pclath intcon option_reg tmr port eedat eeadr tris bank cblock code da data db de dt dw fill __idlocs __maxram res __badram __config Now after you start NotePad++, your ASM files will be nicely highlighted. The above colour selections have been made to go with the black background in the "VibrantInk" style shown in the above screenshot. You may like to change the colours if you use a white background. ==== Settings ==== These settings make using notepad++ easier, but are not mandatory. * Click the 'settings... Preferences' Menu. * In the 'Global' Tab, tick 'Double Click to Close document'. * In the 'Backup/Auto-Completion' Tab, tick 'Enable Auto-completion on each input'. * Where it says "From 1 th input", Click the "1". A dialog box will pop up, type "3" into the box (without the quotes) and hit Enter. * In the 'MISC' Tab, click the number next to "Max number history file" and a dialog box will pop up. Type "30" into the box (without the quotes) and hit Enter. * Click Close. \\ \\ ====== IDE Setup Complete ====== If you made it this far, and you don't need to use AC-Sim, you're done. If that’s the case, enjoy your coding experience! Bye! If you want to use ACSim, you may like to install [[windows_toolchain_codeblocks|Code::Blocks]]. You won’t break anything. :) \\ \\