sammielove45 / propgcc

Automatically exported from code.google.com/p/propgcc
1 stars 1 forks source link

fcache and CMM #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm having a curious problem with the fcache. I've run into this before, but 
for one reason or another wasn't able to make a post for it.

First, why do I assume the problem is the fcache? Because with -mfcache -mcmm 
the program does not work. With the other combinations (no-fcache/CMM, 
LMM/fcache) it works fine. The problematic code is not timing dependent or use 
any I/O.

Thy symptom of this problem is a loop that works if you have sufficient "stuff" 
inside of it (such as a printf or two), but fails when you don't have 
sufficient stuff. The fail mode is execution freezing. Other instances of this 
issue have resulted in gibberish on the pins.

I've tried several times to isolate this problem in a small program to no 
avail. So, I'm posting the full program here. It's the serial driver from 
libpropeller. The particular bit that fails is this:

libpropeller/printstream/printstream.h:

while(formatString[stringIndex] >= '0' and formatString[stringIndex] <= '9'){
    paddingBuffer[paddingIndex++] = formatString[stringIndex];
//  printf("+%c+", formatString[stringIndex]);              
    stringIndex++;
}

This loop works (ie, no freezing) with -mno-fcache, but freezes with -mfcache 
in CMM.

If I uncomment the printf the loop works (completes), even in cmm fcache mode.

I assume that my code is not the issue because of the change in behavior with 
the fcache switch. I'd expect that the code would operate identically with and 
without the switch.

I've attached a minimum working example. To run, make sure the symbolic links 
are good (or copy the files over). Then cd to the libpropeller/printstream/ 
folder. Run "make", then "./run_unit" (or load the .elf).

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

I originally posted this as a forum thread here: 
http://forums.parallax.com/showthread.php/152004-PropGCC-fcache-and-CMM?p=122296
8

Original issue reported on code.google.com by s...@srlmproductions.com on 30 Nov 2013 at 1:22

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the bug report. The problem was in the assembler, which was 
assembling the "leasp" pseudo-instruction incorrectly in non-CMM mode (which is 
needed in FCACHE). A fix is checked in now to the default and release_1_0 
branches.

Original comment by ersm...@hfx.eastlink.ca on 2 Dec 2013 at 12:17

GoogleCodeExporter commented 9 years ago
Works for me. Thanks!

Original comment by s...@srlmproductions.com on 2 Dec 2013 at 5:40