Help - ESOS app_irqs.mcp

4 views
Skip to first unread message

DaveP

unread,
Nov 2, 2009, 9:35:56 PM11/2/09
to PIC24 Assembly-to-C Book
I've been studying the textbook on my own in the evenings in order to
expand my knowledge as an old analog chip designer. It has been
quite
helpful in this regard. From this, you can correctly assume that I do
not have
an extensive background in programming nor in using uCs.

I've completed nearly the entire book, tried many of the examples,
and
completed many of the experiments w/ only the typical problems that I
had to solve along the way. Now I'm experimenting with the ESOS
material for the first time. This is an interesting topic. I've
even
gone to Adam Dunkel's web site to find out more about how
protothreads
are created.

The problem that I am having is that, when I try to compile the
project
app_irqs.mcp, I get multiple occurrances of the error:

" pic24_timer.c:143: undefined reference to `roundFloatToUint32' "

This function's prototype can be found within pic24_util.h.
Pic24_timer.c has a #include statement for pic24_all.h and this, in
turn, would #include pic24_util.h except what is found is:

#ifndef BUILT_ON_ESOS
#include "pic24_uart.h"
#include "pic24_serial.h"
#include "pic24_util.h"
#endif

The referenced project does define BUILT_ON_ESOS and so the
'roundFloatToUnit32' remains undefined.

What I've described is with using the current code archive from the
web 'straight out of the box' and with the PIC24HJ32GP202 as the
selected device in MPLAB. Any ideas on what I am doing wrong?

This is not the only problems that I've had w/ the ESOS examples.
I've tried the echo and reverse_string examples but don't get the
expected response on a PIC24H64GP502 (what you get when you
order the PIC24 breakout board from Sparkfun.com) when compiled
for the Bully Bootloader using the appropriate linker file. Not sure
whether the XMT or RCV side of the UART might be the problem I
thought that I would try the app_irqs.mcp example which doesn't
rely on the RCV.

Any thoughts would be appreciated.

DaveP

Bob

unread,
Nov 3, 2009, 8:59:12 AM11/3/09
to PIC24 Assembly-to-C Book


The code archive has been changing since the book released, and those
functions ( the 'roundFloatToUint32) were added later with this
unintended side effect on the ESOS example for apps_irq.mcp. You can
get around it by copying the missing functions from pic24_util.c to
the apps_irq.c file, but obviously this is not a long term solution
and will need to be fixed.

I am not sure what is up with the echo and reverse string examples,
those should work. JW Bruce is the ESOS expert and is using again in
his embedded systems class being taught this fall, and they are using
the code archive, so I will talk with him. I will also try it myself.

Bob R

Bob

unread,
Nov 3, 2009, 11:47:37 AM11/3/09
to PIC24 Assembly-to-C Book

OK, the problem has been verified -- very strange -- something that
has been changed in the code archive has affected this, we are looking
at it.

DaveP

unread,
Nov 3, 2009, 1:36:18 PM11/3/09
to PIC24 Assembly-to-C Book
Thanks.

Are you saying that the apps_irq problem has been verified or the echo
and reverse string problems? I am at work now and couldn't complete
this offer until this evening, but I can provide further details about
the echo and reverse string symptoms if this would help. Let me know.

Bob

unread,
Nov 3, 2009, 2:19:20 PM11/3/09
to PIC24 Assembly-to-C Book
I tried out the echo and reverse string apps on my mini-bully and
replicated the problem, and showed it to JW Bruce. He is looking into
it; we are not sure what code update broke this. JW is the ESOS
author, he will find the problem.

The apps_irq problem will be fixed by adding the missing functions to
an ESOS library file.

Dave

unread,
Nov 6, 2009, 3:38:57 PM11/6/09
to PIC24 Assembly-to-C Book
DaveP,
A problem has been identified and confirmed in the Microchip C30
optimizer. This is apparently responsible for what you observed in
ESOS. For now, the workaround is to turn off the optimizer. You can do
this in the IDE by going to “project/build options/project”. Then
select the “MPLAB C30” tab. In the “Categories” box, select
“Optimization”. Then click on level 0. After closing the windows, you
will need to execute a “build all”.
> > > at it.- Hide quoted text -
>
> - Show quoted text -

Bob

unread,
Nov 6, 2009, 5:19:29 PM11/6/09
to PIC24 Assembly-to-C Book
Dave,

Thanks for finding the source of this problem and a work around. I
posted on the Microchip forums, and user said that this is fixed in
V3.21 which is currently under test. I downloaded V3.21(Beta) and the
problem still existed, hopefully this is really fixed in V3.21. I
will check when it is released.

I have verified that with using Level 0 optimization, the code
examples work. I believe this is tied to ESOS's use of local
continuations via the C switch statement, so I don't believe (I hope!)
this compiler bug affects any code outside of the ESOS examples.

Bob

Bob

unread,
Nov 6, 2009, 5:22:00 PM11/6/09
to PIC24 Assembly-to-C Book
BTW, I believe this problem originated with Compiler version V3.20,
which was released at the end of August 2009.

DaveP

unread,
Nov 7, 2009, 1:39:57 PM11/7/09
to PIC24 Assembly-to-C Book
Dave and Bob,

Thanks very much for working on this problem. Indeed, my complier is
V3.20 and I downloaded it in September. I turned off the
optimization, as suggested, and all is well again.

Regards,
> > - Show quoted text -- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages