Jump to content

Stephen Tarr

Members
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Stephen Tarr

  • Rank
    Newbrie
  1. Stephen Tarr

    Unhelpful Error Message "missing Right Brace"

    OK, thank you. I suspected as much, but couldn't find anything in the documentation that specifically listed that as a known limitation, and the error message wasn't much help. Please consider this an enhancement request to at recognize the "operator" keyword and perhaps other common but unsupported features and flag them with specific errors or warnings of their own. -Steve
  2. I'm having troubles with some method declarations in one of my classes. I can work around one of the issues but don't have a solution for the second. I've stripped down my code to produce the example here. Issue #1: in the declaration of the copy constructor, BoostC++ requires that I declare the argument as "const class SEGPTR &ptr" while G++ requires only "const SEGPTR &ptr". Apparently, BoostC++ doesn't recognize SEGPTR as a class name until after it's parsed the entire class declaration, while G++ recognizes the type name as soon as it's seen the opening brace of the definition. The workaround is easy: either declare SEGPTR to be a class name (e.g. with "class SEGPTR;") before launching into the definition or add the keyword "class" where needed. But this is a portability issue and the error messages aren't very helpful. Issue #2: the compiler reports "error: missing right brace" at the first line of the assignment operator definition. I haven't been able to find what's causing this error and the error message is not at all helpful. What's going on here and how can I create a working declaration? Thanks, -Steve #include <system.h> // segmented pointer example class SEGPTR { private: unsigned char m_seg; unsigned char m_off; public: // default constructor SEGPTR() { m_seg = 0; m_off = 0; }; // copy constructor // BoostC++ requires "const class SEGPTR &ptr" // while G++ requires only "const SEGPTR &ptr". SEGPTR( const class SEGPTR &ptr ) { m_seg = ptr.m_seg; m_off = ptr.m_off; }; // assignment // BoostC++ rejects this definition with // "error: missing right brace". SEGPTR& operator= ( const class SEGPTR &ptr ) { m_seg = ptr.m_seg; m_off = ptr.m_off; return *this; }; // other methods here... };
  3. The documentation for flash_loadbuffer and flash_write states that the write buffer is 4 words long. That's correct for the older PIC16 devices, but not for some of the newer parts (in particular the PIC16LF193x) that have an 8-word flash row. Does the version of these routines in the pic16x.lib library work with these newer parts, or will I have to write my own access routines? -Steve
  4. I'm compiling code with an external Makefile (cygwin). The rules are set up to build two programs "Courtesy" and "Verify" using a number of common object modules. "Courtesy" is the larger program (by quite a bit) and works fine. "Verify" fails during the linking step, with an "Unexpected program termination!" Here's the log from a complete build of both packages, although note that I get the same results if I try to do a clean build of the "Verify" program alone. (In other words, the error isn't caused by some interference between the two builds.) Following that is the source code for the "Verify" module. "/cygdrive/c/Program Files/SourceBoost/boostc.pic16.exe" -O1 -W1 -t 16F688 Courtesy.c BoostC Optimizing C Compiler Version 6.55 (for PIC16 architecture) http://www.sourceboost.com Copyright(C) 2004-2006 Pavel Baranov Copyright(C) 2004-2006 David Hobday Licensed to Stephen Tarr under Single user Full License for 1 node(s) Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only Courtesy.c success "/cygdrive/c/Program Files/SourceBoost/boostc.pic16.exe" -O1 -W1 -t 16F688 adc.c BoostC Optimizing C Compiler Version 6.55 (for PIC16 architecture) http://www.sourceboost.com Copyright(C) 2004-2006 Pavel Baranov Copyright(C) 2004-2006 David Hobday Licensed to Stephen Tarr under Single user Full License for 1 node(s) Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only adc.c success "/cygdrive/c/Program Files/SourceBoost/boostc.pic16.exe" -O1 -W1 -t 16F688 ascii.c BoostC Optimizing C Compiler Version 6.55 (for PIC16 architecture) http://www.sourceboost.com Copyright(C) 2004-2006 Pavel Baranov Copyright(C) 2004-2006 David Hobday Licensed to Stephen Tarr under Single user Full License for 1 node(s) Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only ascii.c success "/cygdrive/c/Program Files/SourceBoost/boostc.pic16.exe" -O1 -W1 -t 16F688 clock.c BoostC Optimizing C Compiler Version 6.55 (for PIC16 architecture) http://www.sourceboost.com Copyright(C) 2004-2006 Pavel Baranov Copyright(C) 2004-2006 David Hobday Licensed to Stephen Tarr under Single user Full License for 1 node(s) Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only clock.c success "/cygdrive/c/Program Files/SourceBoost/boostc.pic16.exe" -O1 -W1 -t 16F688 config.c BoostC Optimizing C Compiler Version 6.55 (for PIC16 architecture) http://www.sourceboost.com Copyright(C) 2004-2006 Pavel Baranov Copyright(C) 2004-2006 David Hobday Licensed to Stephen Tarr under Single user Full License for 1 node(s) Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only config.c success "/cygdrive/c/Program Files/SourceBoost/boostc.pic16.exe" -O1 -W1 -t 16F688 serial.c BoostC Optimizing C Compiler Version 6.55 (for PIC16 architecture) http://www.sourceboost.com Copyright(C) 2004-2006 Pavel Baranov Copyright(C) 2004-2006 David Hobday Licensed to Stephen Tarr under Single user Full License for 1 node(s) Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only serial.c success "/cygdrive/c/Program Files/SourceBoost/boostlink.pic.exe" Courtesy.obj adc.obj ascii.obj clock.obj config.obj serial.obj "C:\Program Files\SourceBoost\Lib\eeprom.pic16.lib" "C:\Program Files\SourceBoost\Lib\libc.pic16.lib" -O1 -t 16F688 -p Courtesy.obj BoostLink Optimizing Linker Version 6.55 http://www.sourceboost.com Copyright(C) 2004-2006 Pavel Baranov Copyright(C) 2004-2006 David Hobday Optimisation level:1 Warning unreferenced functions removed: isspace in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\ascii.c msRemaining in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\clock.c puts in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\serial.c putHex1 in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\serial.c putHex2 in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\serial.c putHex4 in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\serial.c Building CASM file Memory Usage Report =================== RAM available:256 bytes, used:148 bytes (57.9%), free:108 bytes (42.1%), Heap size:108 bytes, Heap max single alloc:79 bytes ROM available:4096 words, used:4095 words (100.0%), free:1 words (0.0%) Successful "/cygdrive/c/Program Files/SourceBoost/boostc.pic16.exe" -O1 -W1 -t 16F688 Verify.c BoostC Optimizing C Compiler Version 6.55 (for PIC16 architecture) http://www.sourceboost.com Copyright(C) 2004-2006 Pavel Baranov Copyright(C) 2004-2006 David Hobday Licensed to Stephen Tarr under Single user Full License for 1 node(s) Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only Verify.c success "/cygdrive/c/Program Files/SourceBoost/boostlink.pic.exe" Verify.obj ascii.obj clock.obj serial.obj "C:\Program Files\SourceBoost\Lib\eeprom.pic16.lib" "C:\Program Files\SourceBoost\Lib\libc.pic16.lib" -O1 -t 16F688 -p Verify.obj BoostLink Optimizing Linker Version 6.55 http://www.sourceboost.com Copyright(C) 2004-2006 Pavel Baranov Copyright(C) 2004-2006 David Hobday Optimisation level:1 Warning unreferenced functions removed: isspace in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\ascii.c msRemaining in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\clock.c puts in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\serial.c putHex1 in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\serial.c putHex2 in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\serial.c putHex4 in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\serial.c getchar in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\serial.c gets in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\serial.c tab in: C:\Documents and Settings\stevet\My Documents\Electronics\Courtesy\serial.c Unexpected program termination! Failure make: *** [Verify.hex] Error 254 #include <system.h> #include "target.h" #include "clock.h" #include "serial.h" #undef VERBOSE #pragma DATA _CONFIG, _FCMEN_OFF & _IESO_OFF & _BOD_NSLEEP & \ _CPD_OFF & _CP_OFF & _MCLRE_ON & \ _PWRTE_ON & _WDT_OFF & _INTOSCIO volatile uchar dummy; ushort passCount; void main() { // reset power-on and brown-out flags pcon = 0x03; // NOT_POR = 1; // NOT_BOR = 1; // set up system clock (internal osc, 8MHz) clockInit(); // set up timer0 prescaler for millisecond clock // (but don't enable timer0 interrupts until we need the clock) msTimeout = 0; clear_wdt(); option_reg = OPTION_REG_INIT; // set up peripheral ports porta = PORTA_INIT; wpu = WPUA_INIT; trisa = TRISA_INIT; portc = PORTC_INIT; trisc = TRISC_INIT; cmcon0 = CMCON0_INIT; ansel = ANSEL_INIT; // set up serial baud rate generator, enable UART // (interrupt will be enabled later) serialInit(); dummy = rcreg; // (global) enable interrupts (needed for millisecond clock) interrupted = 0; intcon.PEIE = 1; intcon.GIE = 1; // wait a while for the UART output to settle at the // idle voltage and for the T1 oscillator to start msDelay(100); // clear any pending PTT transition, then enable interrupt pttin = 0; dummy = porta; ioc.PTT_IN = 1; intcon.RAIF = 0; intcon.RAIE = 1; for (passCount = 0;; passCount++) { msStart(2200); while (!interrupted) ; interrupted = 0; if (pttin) { // PTT transition pttin = 0; if (porta.PTT_IN) { ushort tw = 2200 - msRemaining; putInt(passCount); space(); putDec2(tw); crlf(); } } if (msTimeout) { putInt(passCount); space(); putstr("timeout"); crlf(); break; } } // fatal error while(1); }
×