Jump to content

Andrew Leiper

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Andrew Leiper

  • Rank
  1. Hi Dave, Thanks for the suggestion. For some reason though the line below didn't seem to put any data in to ROM that I could see. #pragma DATA 0xBC00 0x11,0x22,0x33,0x44 Not sure if it is a bug or I was doing something wrong but I'll continue with my function method for now. Cheers, Andy Leiper IET Ltd
  2. Hi there, OK, after a bit of jiggery pokery I have discovered that I can do this: #define NUM1 0x2211 #define NUM2 0x4433 void romfunc(void) @ 0x1000 { asm { data NUM1 data NUM2 } } This works except that it leaves a return instruction at the end of the data. If there is a better way of doing it though, please let me know. Thanks, Andy Leiper IET Ltd
  3. Hi there, I am trying to store some data in rom at a fixed location so my bootloader knows where to access it. I tried doing this: rom char *rUnitType @ 0x1000 = { 0x99, 0x88, 0x77, 0x66, 1, 2, 3, 4, 5, 6, 7,8 , 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; ...but although the data is in ROM, it is not at 0x1000. Is there a way of doing this in C ? Do I perhaps need to link in an object file created in assembler somehow ? (Sourceboost V7.10, PIC18F) Hope you can help. Andy Leiper IET Ltd
  4. Hi John, Also, if you have any external stimulus such as comms messages, button presses etc you could use them as trigger to sample bit 0 of a fast running timer and shift that into your seed. Andy Leiper IET Ltd
  5. Very good bug reports. Small, clear, easy to reproduce and all were easy to fix :)


  6. Hi Dave, SourceBoost V7.01 PIC18F2525 I'm not sure whether it is valid to assume that conditions are evaluated in the order they are written with SourceBoost but either way the code below generates a compiler error. ////////////////////////////////// #include <system.h> typedef struct { unsigned char a; } TTestStruct; typedef TTestStruct* PTestStruct; TTestStruct s1; PTestStruct ps; void main(void) { ps = &s1; //Removing any one of the 3 conditions allows it to compile while ( (ps) && //Error: Failed to generate expression (p
  7. Hello again, sourceboost V7.01 PIC18F2525 The if statement in the code below compiles so that s.DeviceAddress is decremented instead of s.NumRxDataBytes. if (--s.NumRxDataBytes) 0010 0601 DECF gbl_s, F 0012 5202 MOVF gbl_s+D'1', F 0014 A4D8 BTFSS STATUS,Z ///////////////////////////////////////////// #include <system.h> typedef struct { unsigned char DeviceAddress; unsigned char NumRxDataBytes; } TTestStruct; TTestStruct s; void main(void) { s.DeviceAddress = 1; s.NumRxDataBytes = 0x55; if (--s.NumRxDataBytes) {
  8. Hi there, boostc V7.01 PIC18F2525 Please see comments in the code below: /////////////////////////////////////// #include <system.h> typedef struct { unsigned char bitfield1; unsigned char bitfield2; unsigned char bitfield3; } TTestStruct; TTestStruct s; void SetAVal(TTestStruct *ps) { //This doesn't work because *ps gets copied into a temp variable //which never gets copied back. (*ps).bitfield3 = 5; //This works ps->bitfield3 = 5; } void main(void) { SetAVal(&s); } /////////////////////////////////////// Cheers, Andy
  9. Hi Pavel, boostc v7.01 PIC18F2525 Please see the comments in the code below. It seems with this one as if the compiler is ignoring the brackets and so evaluating (-1/2) to give 0. //////////////////////////// #include <system.h> #define BAD1 ((unsigned short)-1) #define BAD2 (BAD1 / 2) #define GOOD1 (0xFFFF) #define GOOD2 (GOOD1 / 2) unsigned short p; void main(void) { p = GOOD1; //p == 0xFFFF as expected p = GOOD2; //p == 0x7FFF as expected p = BAD1; //p == 0xFFFF as expected p = BAD2; //p == 0 ?????? } //////////////////////////////////
  10. Hi Pavel, boostc v7.01 PIC18F2525 Windows XP The following code generates an "Access violation at 0x00493221 tried to read from 0x00000000". Changing the 300 to 0 or removing some of the |'d values allows it to compile. ///////////////////////////////////////// #include <system.h> typedef struct { unsigned short w; unsigned char d; } TTestStruct; const TTestStruct InitStruct = { 300, ( (0 << 0) | (0 << 2) | (0 << 4) ) }; ///////////////////////////////////////// Hopefully that will be it for the bug reports from me for now
  11. Hi Pavel, boostc V7.01 PIC18F2525 This is a pretty minor one. Please see comments below... /////////////////////// #include <system.h> void (*aTaskPtr)(void); void main(void) { aTaskPtr(); //This compiles OK... (*aTaskPtr)(); //but I think this should be valid too } /////////////////////// Cheers, Andy Leiper IET Ltd
  12. Hi Pavel, boostc v7.01 PIC18F2525 //////////////////////////////////////// #include <system.h> #include <memory.h> typedef struct { char c; } TTestStruct; void InitNodeBuffer(TTestStruct *Node) { //error: arguments of 'memset8' don't match the parameters of call //I didn't think it should be necessary to cast Node to void* here ? memset(Node, 0, sizeof(TTestStruct)); memset((void*)Node, 0, sizeof(*Node)); //error: can't get size of the expression memset((void*)Node, 0, sizeof(TTestStruct)); //Compiles OK } //////////////////////////////////
  13. Hi Pavel, boostc V7.01 PIC18F2525 The compiler seems to ignore the 'm' in the code below and come up with an "error: failure" message. ////////////////////////// /* *m/ */ void main(void) { } ////////////////////////// Cheers, Andy Leiper IET Ltd
  14. Hi Pavel, It's me again I am afraid boostc v7.01 PIC18F2525 warning: '->' is used with a non-pointer (use '.' instead) If I avoid using the pTestStruct typedef it compiles OK. //*********************** #include <system.h> typedef struct { char kw[5]; } TTestStruct; typedef TTestStruct* pTestStruct; typedef struct { pTestStruct k; //k is the 128 bit key. } TParams; TParams XXP; void main(void) { char p; p = XXP.k->kw[0]; //Warning here while(1); } //***********************
  • Create New...