Jump to content

carolyn

EstablishedMember
  • Content Count

    14
  • Joined

  • Last visited

Community Reputation

0 Neutral

About carolyn

  • Rank
    Newbrie
  1. Also found that the array fails to compile with auto-initialisation. #include <system.h> typedef struct { unsigned long MaxDskSize; char ClusterSize; } DISKSIZETOCLUSTERSIZE; void main() { DISKSIZETOCLUSTERSIZE ClusterSizeTable16[] = {{0,0}}; } Carolyn
  2. I am sorry but it seems that the fault was not due to the return but because of a typedef I had in a include file. By including the typedef FAT it seems that the FAT in FAT_type gets affected. #include <system.h> typedef struct { int var; } BIOS_PARAM_BLOCK; unsigned char FAT_type(BIOS_PARAM_BLOCK *,unsigned long *); typedef unsigned short FAT; //************ void main() { BIOS_PARAM_BLOCK *bpb; unsigned long CountOfClusters; FAT_type(bpb,&CountOfClusters); } unsigned char FAT_type(BIOS_PARAM_BLOCK *bpb , unsigned long *cc ) { return 0; } Carolyn
  3. Hi, I am working on a complex program and used VC++ to test before compiling to a PIC. However now when compiling using the SB compiler it fails when compiling: unsigned char FAT_type(BIOS_PARAM_BLOCK *,unsigned long *); void main() { BIOS_PARAM_BLOCK *bpb; unsigned long CountOfClusters; FAT_type(bpb,&CountOfClusters); } if I add a return varible it compiles OK unsigned char FAT_type(BIOS_PARAM_BLOCK *,unsigned long *); void main() { BIOS_PARAM_BLOCK *bpb; unsigned long CountOfClusters; unsigned char c; c = FAT_type(bpb,&CountOfClusters); } This seems like a bug (non-ansi) and will cause a lot of extra editing.
  4. Smache, This is standard C char pointer assignment all compilers work this way. Try creating an array or allocating space for the string and use strcpy this should reduce the ram usage. Carolyn
  5. Dave, This is why I am using a cooperative kernal as I cannot access the stack to return to a started task. However for delays the user will place the del_task() function at the point in the task where the delay is required. This function will in fact be a macro that terminates the users task function and start another that can be called when the delay is compete. So: char x; void task() x = 0; del_task(100,label); // wait 100 timer ticks x = 1; } actually becomes char x; void task() { x = 0; del_task(100); } void label() { x = 1; } Of course there would be restriction in that only global vars can be used if delay task is used. I havent fully worked out events yet but they would be similar. Carolyn
  6. Hi Picxie and Dave, The RTOS is a work project to help simplify some of the designs. We use PIC16 devices usually with only 2K EPROM so the RTOS needs to be simple. I will be implementing a prioritised context switching cooperative kernel with return to kernel delays and inter-task events and I hope to keep the kernel and its resources within 1K ie half the 2k program memory. If it works as I intend then I may extend it for larger devices. However I cannot produce a general RTOS without pointers to functions. The solution provided by Dave will get me started but I have to hard wire the tasks into the kernel. Thanks Carolyn
  7. struct process { char id; char priority; struct process *next; }; Gives error: rtos.c C:\Program Files\SourceBoost\Samples\C\BoostC\rtos\rtos.c(7:2): error: unknown struct 'struct process' Carolyn
  8. I know that function pointers are not yet supported but an easy call to an arbitry function can be done in assembler with: movlw HIGH(function) movwf address movlw LOW(function) movwf address+1 call fpointer <next instruction> ------ fpointer movf address,w movwf PCLATH movf address+1,w movwf PCL ------ function < body > return This can all be done with the asm { } construct if there was a way of getting the address of the function as HIGH and LOW are not supported. Is there a way of getting a function address? Or is there a way of directing where a function's origin is so that the address is known that way? Or lastly when will function pointers be available? Carolyn PS I am writing a RTOS.
  9. But the BoostC Compiler Help claims Data types Base 1 bit bit, bool 8 bits char,unsigned char,signed char 16 bits short,unsigned short,signed short 16 bits int,unsigned int,signed int 32 bits long,unsigned long,signed long plus compiler is ANSI C so it should support char as signed char If char is not supported as signed it should be in the compiler help as a caveat. Carolyn
  10. char c; c = -1; options = 0; if (c < 0) { options = 1; } Does not set options to 1 due to incorrect compile of 'if' statement as it seems to consider 'c' as unsigned. Code generated by 'if' is MOVLW 0x00 SUBWF main_1_c, W BTFSC STATUS,C GOTO label268437195 should be MOVF _c, W SUBLW 0x00 BTFSC _status,C GOTO label268437195 or better still BTFSS _c, 0x80 GOTO label268437195 Carolyn
  11. Thanks Picxie I am already using in line asm but the idea is to use C as much as posible Carolyn
  12. Sorry first part of message was a repeat of my first post However if (++b1) gives INCF gbl_b1, F MOVF gbl_b1, F BTFSC STATUS,Z GOTO label268436982 should be INCF gbl_b1, F BTFSC STATUS,Z GOTO label268436982 a0=a1=a2=0; is strange gives CLRF gbl_a2 MOVLW 0x00 CLRF gbl_a1 MOVWF gbl_a0 Carolyn
  13. Further testing and writing of my application I have found that my previous example is not the only case of non-usage of the 'F' for simple register instructions take a = ~a; this becomes comf a,w movwf a and even worse long a; a = ~a; becomes comf a,w movwf tmp comf a+1,w movwf tmp+1 comf a+2,w movwf tmp+2 comf a+3,w movwf tmp+3 movf tmp,w movwf a movf tmp+1,w movwf a+1 movf tmp+2,w movwf a+2 movf tmp+3,w movwf a+3 whereas it should be comf a,f comf a+1,f comf a+2,f comf a+3,f Carolyn
  14. I have just started using this compiler and with code space being important and generally using assembler I was suprised by the compiling of the line below trisc = ~trisc; used to toggle IO on portc. the complier generates COMF gbl_trisc, W MOVWF gbl_trisc whereas COMF gbl_trisc, F would be the usual assembler for this Perhaps I am expecting to much but with only 2K of code space every word counts. Does the compler ever generate COMF gbl_trisc, F if so how other than in-line asm can I get a simple complement. Thanks for any reply Carolyn
×
×
  • Create New...