Pumpkin, Inc.

Pumpkin User Forums

OSBYTES_OF_DELAYS kills custom library

For issues specific to Microchip's PICmicro® MCUs, including compilers (e.g. HI-TECH PICC & PICC-18, Microchip MPLAB®-C18) and IDEs (e.g. Microchip MPLAB®).

OSBYTES_OF_DELAYS kills custom library

Postby DFx_Tech » Mon Sep 27, 2004 7:52 am

Hi,

I've got a problem with trying to enable 16-bit delays via a re-compile of the libraries.

The target is a PIC18F242 and I’m using slc18sfa.lib as a base.
The system tick rate is 1KHz with the instruction clock at 4MHz (16MHz crystal).

If I leave my salvoclc1.h empty the custom library functions fine, with OS_Delay() using 8-bit delays as expected.

But if I add:

#undef OSBYTES_OF_DELAYS
#define OSBYTES_OF_DELAYS 2

the library generated does not function correctly, only the interrupt (on TMR0) remains running, all the tasks halt, this happens even if I use 'OSBYTES_OF_DELAYS 1' which should be the same as leaving salvoclc1.h empty.

Does anyone know what's happening?

Thanks,

Jon Starr
DFx Technology

DFx_Tech
 
Posts: 14
Joined: Tue Sep 07, 2004 11:00 pm
Location: Witney, Oxfordshire, England

Re: OSBYTES_OF_DELAYS kills custom library

Postby aek » Mon Sep 27, 2004 8:08 am

Hi Jon.

If this is the first time you've built and used a custom library, I suspect that somewhere in the process something is set wrong.

Things to check:

1) Do a source-code build using 2-byte delays to ensure everything is alright. Recommend you do this is a separate project.

2) Build the custom library in Cygwin. Compare the size of the custom library vs the one you've based it on.

3) Build the library-based project and compare its size (ROM and RAM) to the one using the default library. Both ROM and RAM should be larger.

Typical problems include using a salvoclcN.h but forgetting to change the library you're linking to to be the custom library ...

If all else fails, email support with the custom library you want and we'll generate it for you along with an example project.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: OSBYTES_OF_DELAYS kills custom library

Postby DFx_Tech » Mon Sep 27, 2004 8:31 am

Hi Andrew,

Thanks for the quick reply:

Yes the library is being built in Cygwin with the latest make.

The new library requires roughly 2% more memory when built into the project, its physical size on disk is bigger as well.

I'm definitly including the correct library (slc18sfa-clc1.lib) and I have OSLIBRARY_CUSTOM_CONFIG set to 1 in my salvocfg.h.

I'll try a source-code build now and see what happens.

- Jon

DFx_Tech
 
Posts: 14
Joined: Tue Sep 07, 2004 11:00 pm
Location: Witney, Oxfordshire, England

Re: OSBYTES_OF_DELAYS kills custom library

Postby DFx_Tech » Mon Sep 27, 2004 10:13 am

I've just done a source-code build and it's working fine with 16-bit delays.

I'm just going to go over all of my configuration options just to make sure I haven't done something stupid and if that fails I'll email support tommorow.

- Jon

DFx_Tech
 
Posts: 14
Joined: Tue Sep 07, 2004 11:00 pm
Location: Witney, Oxfordshire, England

Re: OSBYTES_OF_DELAYS kills custom library

Postby DFx_Tech » Wed Sep 29, 2004 3:01 am

First, I'd like to say thank you for building my library so quickly, it's nice to deal with efficient customer support for once.

Unfortunatly it hasn't solved the problem, I've run a binary diff on the library you sent me and the library I generated, they are slightly different but thats probably due to different C18 compiler versions.

I've attempted a little bit of troubleshooting and have got some interesting results:

Interupt is the only thing running.

Salvo spends ALL of its time in the scheduler (I single stepped for quite a long time and it never left, just kept looping).

Tasks and binary semaphore initialisation return 0 so they are all created correctly.

Setting breakpoints show that tasks are never even entered to begin with, so its not yielding problem.


I wouldn't really be that bothered except that a source-code compile takes 5 mins on my machine and it really slows developement down.

The strangest thing is that is does work with the standard libray just fine.

-Jon


Edit:

Probably more helpful would be to list where Salvo is looping around:

[Starting from OSSched() in its infinite loop]

OSCLEAR_WATCHDOG_TIMER();
OSBeginCriticalSection();

while ( OSsigQoutP ) then evaluates to 0 so it misses that entire section.

OSLostTicks becomes one every interupt and is decremented, OScTcbP = OSdelayQP; always results in zero.

OScTcbP = OSeligQP; (both are always zero).

OSSuspendCriticalSection();
OSIdlingHook();
OSResumeCriticalSection();

OSEndCriticalSection();


And then it returns to the infinite loop with OSSched() in it.


If I read the comments right, this seems indicate that the queue contains no eligable tcb's so it's just idle forever.

[This message has been edited by DFx_Tech (edited September 29, 2004).]

DFx_Tech
 
Posts: 14
Joined: Tue Sep 07, 2004 11:00 pm
Location: Witney, Oxfordshire, England

Re: OSBYTES_OF_DELAYS kills custom library

Postby aek » Wed Sep 29, 2004 7:02 am

Hi Jon.

At this point, since I know the library to be good (since I tested it), it's likely to be some sort of configuration issue. Dunno what. Best bet is to .zip the entire project directory and email it to me ... sounds like it can be simulated in MPLAB SIM just fine, and that should reveal any problems.

5 min for a source-code build seems odd -- on a 500MHz PII + Win988 (ancient), a source-code build in MPLAB v6 is typically 30-45s. On a 2.4GHz + Win2k, it's about 10s.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: OSBYTES_OF_DELAYS kills custom library

Postby aek » Wed Sep 29, 2004 11:20 am

Hi Jon.

OK, that one took me a while ...

You have OSLIBRARY_CUSTOM_CONFIG in your salvocfg.h ... but it should be OSCUSTOM_LIBRARY_CONFIG.

Change that, ensure that salvoclc1.h is in salvoinc, and you should be good to go.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: OSBYTES_OF_DELAYS kills custom library

Postby DFx_Tech » Thu Sep 30, 2004 12:39 am

Works like a charm now.

Many thanks for the help Andrew.

DFx_Tech
 
Posts: 14
Joined: Tue Sep 07, 2004 11:00 pm
Location: Witney, Oxfordshire, England


Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 1 guest

cron