Jump to content

Codeblocks and ACSim


DavidBanner
 Share

Recommended Posts

I've got codeBloack and ACSim up and running - nice one stryd and audiocommander!

it's all working, and I've managed to compile and build and the console_runner is working.

can someone please explain how to use ACSim to develop? I get the idea that you can set input stuff from the console_runner interface, but how can you inspect the vars etc in CodeBlocks?

am I missing the GDB plugin or something?

Link to comment
Share on other sites

Hi David,

thanks for the feedback!

Nice to hear, someone uses it :)

There are two possible uses.

1. normal mode:

if you see the console output, you can type in values to trigger various functions of the skeleton,

eg. if you type:

    [tt]m176,12,100[/tt] {-> return key}

this function is called from the main.c with the appropriate values:

    [tt]MPROC_NotifyReceivedEvnt(evnt0 176, evnt1 12, evnt2 100);[/tt]

if you would type:

    [tt]a0,100[/tt]

this will be called in main.c

    [tt]AIN_NotifyChanged(pin 0, value 100);[/tt]

You will see any LCD messages printed on the console and also all MIDI messages will be printed, so you can easily see if your application works like you expect.

The rest of the inputs possibilites (like m144,10,0 or a1,0 or d5,1 for switching digital input #1 to ON ...) is printed out as start-message.

You can easily add your own functions if you look at "ACSim_console.c", line 60 ff

2. debug mode:

I'm not exactly sure how it works with Code::Blocks, but in XCode you can set breakpoints anywhere in the code. Now when you don't "RUN" but "DEBUG" the application, the application flow is stopped once a breakpoint is reached. You can then interspect all local and global variables in a graphical debugger window and watch the changing values by stepping each expression via different buttons (next expression, continue, leave function... etc)

Maybe Stryd_ can add some words to the debug use of Code::Blocks.

Hope this helps!  ;)

Cheers

Michael

Link to comment
Share on other sites

Hey Michael,

As usual - got myself all lost, asked the question, poked it with a stick a bit more and then started to figure it out.

I was expecting something a bit more graphical to happen in codeblocks, ala the image in the install docs, but I think I've got the hang of it now...

Fantastic little app - I'm over the moon to have found it. Thanks again for the code!

Link to comment
Share on other sites

As usual - got myself all lost, asked the question, poked it with a stick a bit more and then started to figure it out.

Oh, thank god! I always thought I'm the only one doing it this way ;D

I think most MIOS functions are already implemented, but it might be there are some missing... just check out the Wiki if there's a newer version available (I'm constantly adding a few lines here and there) or contact me if you got problems with it or need help by adding something. I really like to see this app becoming more and more complete... it helped me in so many cases; ...even if it can't cover all SDCC-bugs or strange behaviors ;)

good coding!

Michael

Link to comment
Share on other sites

Cheers Michael,

Your help is most definately appreciated!

I'm blown away by how handy this app is! I would have started development of the software much sooner if I'd known about this baby - I thought I'd need my midibox finished to the point of at least 1 channel and master section.

Oh, thank god! I always thought I'm the only one doing it this way Grin

lol, there's another way?

and the best thing - I get to code my midibox app while I get paid to look like I'm coding something entirely different ;), which I couldn't do if I had the midibox equivilent of frankenstein's bride attached to my laptop.

I will try and lend a hand on the dev work where I can be of use...

BTW: stryd really should get a massive big up for the Code::Blocks stuff he did - the WIKI article is one of the best written tech docs I've seen. Not being funny but I've seen people who've worked at companies for 5 years spend 6 hours getting a dev enviroment running - the setup was a breeze for me without ever having seen the beast before...

Link to comment
Share on other sites

Glad it helped mate. The way the wiki headings work is really good for this kind of doco, because it allows the name to write out the entire procedure, but it makes it easy for the reader to skip to the parts they are interested in, so there's no information overload. I really like it :)

I'm building a PC for the lab at the moment and over the course of this week I'll be updating the doco to include some stuff I missed, and to reflect new features in C::B - including how to get that nice graphical tree-view display of the variables when debugging, like in the XCode pic that AC posted (OK it's not that pretty but it's the same functionality). I'll also be posting links to the C::B, SDCC and GDB manuals, which can be really handy, and you might want to get before I finish ;)

Link to comment
Share on other sites

I'm having some issues with code::blocks.

I can set up new projects, run them etc etc

but

I've created a new project using the skeleton provided, and dropped the code from the ain64_din128_dout128_v2_0 app in the directory.

Codeblocks throws lots of errors when I try to compile. I've tried to compile using the shell-make and it works fine...

also - when I'm using the skeleton and added the following line to MPROC_NotifyReceivedEvnt():

MIOS_DOUT_PinSET(pin,evnt2);

I get this error: undefined reference to 'MIOS_DOUT_PinSet'

any ideas what's going on?

Link to comment
Share on other sites

Hi David,

have you followed the notes on the ACSim page?

You have to configure some ACSim files if you're going to use them:

ACSim_console Adaption required!

ACSim_toolbox No changes required

ACSim_mios No changes required

You have to #include your c-files in ACSim_console as you would add them to the MAKEFILE.SPEC!

But the ACSim files are all well commented and it's easy to see where you have to customize things.

And you have to change some #includes in all your project source-files (like in main.c), that means: if _DEBUG_C is not defined (target -> *.syx) then include MIOS header, if _DEBUG_C is defined (target -> ACSim) then the ACSim classes will get included. That also means, that the codespace is strictly separated, because we don't want to have anything from the ACSim stuff stealing valueable space on our PIC!

#ifndef _DEBUG_C

#include "cmios.h"

#include "pic18f452.h"

#endif

There are some more minor adaptions required, but they're all described in the ACSim Setup Guide.

Stryd's comment is also quite useful: your Debug-Target should contain a list of c-files that will be compiled. As you're including the .c files in the ACSim and not only headers, you must not put any file in the target besides the Simulator classes. Else there are doubled vars, symbols and functions.

As this sounds all a lot more complicated than it is in fact, here is a short summary:

- in main.h: declare DISPLAY_INIT() as extern so it can be called from the simulator

- in main.c and all other custom .c-files: add #ifndef _DEBUG_C (see above) to exclude "cmios.h" and "pic18f452.h"

- in ACSim_console.h: customize by your needs (LCD-Size, num of AINs etc...)

- in ACSim_console.c: #include additional .c-files

- in your C:B target: make sure only the ACSim classes (ACSim_console.c, ACSim_mios.c, ACSim_toolbox.c) get compiled!

Then it should run fine and you can easily switch between both targets using the same code.

Best regards,

Michael

Link to comment
Share on other sites

Hi Michael,

Thanks for all the info...

Now I am really confused.

I haven't got any of the ACSim files in my project directories (previously been using the Download the MIOS SDCC Skeleton Application Template)!! Yet I'm working with the ACSim console - weird....

do these files go in the root of the project or are they in a directory? and is there somewhere to download them or do I need to copy and paste from the wiki?

Link to comment
Share on other sites

oh, sorry, then I got it wrong  ::)

Before adding ACSim, I would try to get the C:B project right.

I'd copy and paste the sources from the wiki. You also get the latest versions this way...

Sorry having confused you -

After being the reason for stryd's brain-explosion last week, I should spend a bit more attention to my words  :P ;D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...