mios_c_simulator_-_debugger
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
mios_c_simulator_-_debugger [2006/09/11 10:15] – removed ASM-compile options for linux (not relevant here) audiocommander | mios_c_simulator_-_debugger [2008/05/21 02:13] (current) – Testing stryd_one | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | AC-Sim: AudioCommander' | ||
+ | Please see [[mios_c_simulator_-_debugger# | ||
+ | If you add something make sure, you note it here, otherwise your submissions might get overwritten! | ||
+ | |||
+ | |||
+ | \\ | ||
+ | ====== Concept ====== | ||
+ | |||
+ | AC-Sim allows you to compile your MIDIBox Application as a command-line application on your Mac or PC (should also run fine with Linux). | ||
+ | Input such as knobs, sliders, buttons (ie AIN and DIN) and MIDI Input can be simulated by entering commands, and the output of the LCD and MIDI Out will be displayed in the console. Please refer to the section "Usage (Manual)" | ||
+ | |||
+ | But you'll discover the real strength of the simulator once you are going to use the graphical debugging interface of your IDE -> you can inspect all the variables and their contents! | ||
+ | |||
+ | It reduced my number of application uploads dramatically and to be able to use a graphical debugger to watch some variables is quite helpful... Look at that (Pic shows Xcode' | ||
+ | |||
+ | {{http:// | ||
+ | |||
+ | Isn't that nice? | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | ====== Overview ====== | ||
+ | The Simulator currently consists of these files: | ||
+ | |||
+ | ^ Source ^ Contents ^ Notes ^ | ||
+ | | **ACSim_console** (Console based input, main runloop) | | Adaption required! | | ||
+ | | [[acsim_console_h|ACSim_console.h]] | Hardware related defines | Change #defines to reflect your settings | | ||
+ | | [[acsim_console_c|ACSim_console.c]] | Main runloop | Add additional c. source-files here | | ||
+ | | **ACSim_mios** (MIOS Emulation) | | //No changes required// | ||
+ | | [[acsim_mios_h|ACSim_mios.h]] | pic18f452.h typedefs and global vars | //No changes required// | ||
+ | | [[acsim_mios_c|ACSim_mios.c]] | MIOS functions for simulation | //No changes required// | ||
+ | | **ACSim_tools** (Tools & Helpers) | | //No changes required// | ||
+ | | [[acsim_toolbox_h|ACSim_toolbox.h]] | Hexview config | //No changes required// | ||
+ | | [[acsim_toolbox_c|ACSim_toolbox.c]] | Helpers like random generators and hex-view | ||
+ | | [[acmididefines|ACMidiDefines.h]] | ||
+ | |||
+ | You can download the files in a {{acsim.zip|.zip file here}}. If you make any updates, please send them to sstryd_one and he will update the zip for you. | ||
+ | |||
+ | |||
+ | <box 75% left bluelight|SCM Code News>I created a SCM page for ACSim, but as the current SCM-implementation of Xcode is quite lousy, I will wait for the Leopard version to complete this step. That means the next update 0.0.8 will follow in the near future and will contain some major changes. I am happy for anyone joining the dev team! | ||
+ | http:// | ||
+ | // | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | \\ | ||
+ | |||
+ | To implement the ACSim files into your applicaton, you just have to follow the [[mios_c_simulator_-_debugger# | ||
+ | |||
+ | * Modify **main.c** and **main.h** | ||
+ | * Adapt your settings (#defines, #includes) in **ACSim_console.h** as required for your debugging purposes. | ||
+ | * If you have multiple sources, also #include your .c-sources in **ACSim_console.c** | ||
+ | |||
+ | * Configure your IDE: | ||
+ | * Set up a new target (command-line application) | ||
+ | * Add // | ||
+ | * Build and run | ||
+ | |||
+ | \\ | ||
+ | When running/ | ||
+ | * MIOS_Init() | ||
+ | * MIOS_LCD_Init() | ||
+ | * MIOS_Tick() is polled each runloop() | ||
+ | * MIOS_Timer() is polled each runloop() when a timer has been set | ||
+ | |||
+ | For detailed step-by-step instructions see //Setup Guide// below! | ||
+ | |||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | ====== Usage (Manual) ====== | ||
+ | |||
+ | These input commands are currently available: | ||
+ | *(**q**)quit | ||
+ | *(**SPACE**)OK | ||
+ | *(**r** )andom | ||
+ | *(**++**) (**-**) | ||
+ | *(**e**)ncoder(**++**)/ | ||
+ | *(**a**)(// | ||
+ | *(**b**)yte(// | ||
+ | *(**j**)umper(// | ||
+ | *(**p**)rogramChange(// | ||
+ | *(**m**)idiMessage(// | ||
+ | *(**n**)oteOn(// | ||
+ | |||
+ | \\ | ||
+ | **Examples: | ||
+ | * Type " | ||
+ | * Type "a2, 560" to call AIN_NotifyChange(pin 2, value 560) | ||
+ | * Type " | ||
+ | * Type " | ||
+ | * Type " | ||
+ | * Type the Space-Key to simulate the BUTTON_OK has been pressed -> calls DIN_NotifyChange(OK, | ||
+ | * Type " | ||
+ | * Type " | ||
+ | * Type " | ||
+ | * Type " | ||
+ | * Type " | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ====== Setup Guide ====== | ||
+ | |||
+ | If you haven' | ||
+ | |||
+ | [[how_to_use_xcode2_as_ide_on_a_mac|Setup Guide for XCode on Mac]]\\ | ||
+ | [[windows_toolchain_codeblocks|Extend your toolchain with Code:: | ||
+ | |||
+ | [[application_development|General Development Info]] | ||
+ | |||
+ | |||
+ | \\ | ||
+ | \\ | ||
+ | Then proceed by configuring your main.c, and .h files: | ||
+ | |||
+ | == main.c == | ||
+ | |||
+ | Minor modifications are required to your MIOS Application' | ||
+ | |||
+ | * You need to edit some lines at the top of your main.c - this is to avoid including headers for the PIC/MIOS Core module, when compiling a console app for debugging. Because of the #ifndef statement this does not change your syx-project code, so your app will compile as normal for the PIC! | ||
+ | |||
+ | Before: | ||
+ | <code c> | ||
+ | #include " | ||
+ | #include " | ||
+ | </ | ||
+ | |||
+ | After: | ||
+ | <code c> | ||
+ | #ifndef _DEBUG_C | ||
+ | #include " | ||
+ | #include " | ||
+ | #endif | ||
+ | </ | ||
+ | |||
+ | == main.h == | ||
+ | |||
+ | * you need to add some lines at the bottom of your main.h, or, if you don't have one, main.c - this is because debug_mios.c calls " | ||
+ | |||
+ | <code c> | ||
+ | #ifdef _DEBUG_C | ||
+ | // export functions that are called from within debug_mios.c | ||
+ | // (e.g. to trigger DISPLAY_Init after sending...) | ||
+ | extern void DISPLAY_Init(void); | ||
+ | #endif | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | \\ | ||
+ | == ACSim_console.h == | ||
+ | |||
+ | * Choose your OS by enusering that only one of these lines is remarked (the one you DON'T want!) | ||
+ | * //#define _DEBUG_OS_WIN | ||
+ | * //#define _DEBUG_OS_MAC | ||
+ | | ||
+ | * Select the LCD-Size | ||
+ | * Set the number of AIN-Lines | ||
+ | * Set the number of ENCoders | ||
+ | * If needed set DIN-Buttons like " | ||
+ | | ||
+ | |||
+ | \\ | ||
+ | == ACSim_console.c == | ||
+ | |||
+ | If you have more than just main.c, you have to add the source to these .c files (c only, no headers, else you will get a bunch of compile errors. See the comments in the ACSim_console.c file for details. | ||
+ | |||
+ | |||
+ | \\ | ||
+ | == ACSim_mios & ACSim_Toolbox incl. ACMidiDefines == | ||
+ | |||
+ | These files don't need to be changed, just add them to your project. | ||
+ | |||
+ | |||
+ | Done! | ||
+ | :) | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | ====== Release & Developer Notes ====== | ||
+ | This entry is still in work. It is very incomplete! Especially beginners should be aware of that it's not yet easy to use. This code is mainly intended to simulate and debug new applications. However, if you know C just a bit, you are welcome to try it! | ||
+ | |||
+ | |||
+ | Everyone is welcome to add lines and code! Change anything! Don't be afraid; I don't see this as _my_ work, I hope the code gets completed piece by piece until we finally have a nice simulator/ | ||
+ | |||
+ | \\ | ||
+ | Update 0.0.4: now works on MS Windows with GCC (and probably other compilers too) // stryd_one // | ||
+ | |||
+ | Update 0.0.5: splitted code to seperate wiki-documents, | ||
+ | |||
+ | Update 0.0.5-r1: Splitted ACSim_toolbox into header and source // audiocommander // | ||
+ | |||
+ | Update 0.0.5-r2: 2007 January 17 improved MIOS_IIC for SpeakJet debugging // audiocommander // | ||
+ | |||
+ | Update 0.0.6: 2007 January 21 added MIDI-Merger, | ||
+ | |||
+ | Update 0.0.7: 2007 January 26 added MIDI-Debug Messages, improved Timer() calls, added Tick() calls // audiocommander // | ||
+ | |||
+ | \\ | ||
+ | \\ | ||
+ | **Notes to developers** | ||
+ | |||
+ | Some MIOS_function parameters have slightly been changed due to compile errors. | ||
+ | If you have questions or would like to try it, you can ask in the forum! I'll give my best to help you using ACSim. It's a bit troublesome in the first three hours, but once you got it, it really helps developing MIOS-apps dramatically!!! | ||
+ | |||
+ | **Please** FIXME | ||
+ | * Lots of hardcoded return values (eg. MIOS_ENC_SpeedGet) | ||
+ | * Bankstick could be written to and read from a file | ||
+ | * Many functions are not yet fully implemented. If you add something valueable, please update the Wiki-Sources too or PM me and I'll put it in for you! |