Jump to content

DTPIC

EstablishedMember
  • Content count

    32
  • Joined

  • Last visited

Community Reputation

0 Neutral

About DTPIC

  • Rank
    Regular

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi Reynard, I am using PIC18F (45K22). I cant really send you full source code, as these are commercial designs and "the customer's property". But here are some snippets: This is the code as I have followed it; I know I'm not infallible, and I did try to say "if I'm right" ...(!) see what you think of my understanding: Looking in the asm output, a RAM byte is assigned for the array called "sw_id": gbl_sw_id EQU 0x000002FC ; bytes:1 // why!?!?! Then the _startup code does this: _startup MOVLW 0x00 MOVLB 0x02 MOVWF gbl_segmap, 1 MOVLW 0x01 MOVWF gbl_sw_id, 1 MOVLW 0x02 MOVWF gbl_xfm_id, 1 MOVLW 0x03 MOVWF gbl_sw_xform, 1 MOVLW 0x04 MOVWF gbl_mastermodename, 1 MOVLW 0x05 ... where segmap, sw_id, xfm_id, swxform, mastermodename, are all rom char* arrays. Isn't this putting an array token number into RAM? Example: 'C' definition of sw_id array: // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 // <-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-> rom char *sw_id = "CFGDM1MODTD1TU1DM2TU2TD2DSBDSADM3TD3TU3TD4TU4DM4---"; A typical use of the array in 'C' would be romstrget(sw_id,start,length,dest_array); // romstrget is my function which accesses the array at the array position given by "start", // then copies "length" bytes to "dest_array", terminating in 0x00 At the asm level, the array is accessed using: MOVLB 0x02 MOVF gbl_sw_id, W, 1 MOVLB 0x03 MOVWF romstrget_00000_arg_romstr, 1 MOVF main_1_j, W, 1 MULLW 0x03 MOVF PRODL, W MOVWF romstrget_00000_arg_start, 1 MOVLW 0x03 MOVWF romstrget_00000_arg_len, 1 MOVLW HIGH(gbl_msg_tmp+D'0') MOVWF romstrget_00000_arg_str+D'1', 1 MOVLW LOW(gbl_msg_tmp+D'0') MOVWF romstrget_00000_arg_str, 1 CALL romstrget_00000 Isn't MOVF gbl_sw_id,W,1, attempting to access the rom array using a RAM based token value? I haven't followed the code to the absolute letter \ byte at this point, so you may be able to set me on the right path...! Thanks for your time.... still think its a great little compiler, and I'm looking forward to Chameleon...
  2. I recently had a problem with arrays held in RAM being corrupted, so I thought i would move them to ROM using rom char *. I found that it was still possible to corrupt the array output! Here's what i think happened... It looks like the compiler assigns a 256 byte ROM area to every rom char array, regardless of actual size. It then assigns a "rom char array number" (1,2,3, etc) to each array for identification: THEN IT STORES THAT NUMBER IN RAM! Consequently, if the area of RAM holding the rom char array number is corrupted, then the rom array output is also corrupted (because you are probably looking in the wrong place in ROM). As a (licenced!) commercial user, it is sometimes necessary to try to ensure the contents of a lookup table or array at all costs. (Yes, I am the first to agree that I should be preventing the overwrite of RAM!). If the above is a correct observation, then 1) this assignment of rom char numbers to RAM is not a good idea-it can be corrupted 2) we seem to be burning 256 bytes of ROM per array regardless of required size, which also does not help in a tight for space application. Looking at the assembly output, it would seem reasonable to hard code the rom array base address; this would also make it easier to make the arrays only the length they need to be (and leave more code space available). Maybe you can take this into consideration if you are revisiting rom char array handling in Chameleon. (...and it would also be good to be able to assign the contents with 0xnn or \xnn - I think others have reported problems here?) Thanks for listening!
  3. Only other things I can tell you: 1) I use the "#if 1.... #endif" and "#if 0.... #endif" constructs to include\"comment out" sections of experimental code... 2) I have used nested #ifs \ #ifdefs sometimes to 3 or more levels... 3) there may be #if\#ifdef\#endifs existing inside /*...*/ commented out code, or #if \ ifdef \ #endifs commented out using //.... Hope this helps...
  4. Hi Pavel, I would love to be able to help debug Chameleon, but this code is commercial and I would have to get the customer's permission to send it out to a third party; I don't think they would want to, but I will ask....
  5. I have taken a BoostC project which compiles fine and tried to compile using Chameleon - did a "clean all" then "build" - got the response "failed to index input file", with no extra information about the problem... What does this message mean? What do I need to look for to fix it? Is there a (pdf?) help guide anywhere for Chameleon, or extra info which which would help to debug?
  6. I have a routine like: EEPROMwrite(unsigned char addr, unsigned char* str, unsigned char len) { // print out hex of string of length "len"... } I call it using hex replacement values in a string, ie using the "\xnn" replacement method: EEPROMwrite(,addr, "\xFF\x00\x01",3); (prints 00 00 01) Now, if a "\x" replacement in the string contains FF (or ff) , the hex value read \ printed is 00 .. BUT if the value is preceded by another value (which is not 00 or FF), eg, EEPROMwrite(,addr, "\01\xFF\x00",3); (prints 01 FF 00) ... it correctly reads \ prints the hex value as FF! To be clear, EEPROMwrite(,addr, "\00\xFF\x00",3); (prints 00 00 00) ... does NOT print out FF, as the preceding value is 00.. I have checked the web and this does not seem to be expected behaviour - can you look into it please?
  7. I have a routine like: EEPROMwrite(unsigned char addr, unsigned char* str, unsigned char len) { // print out hex of string of length "len"... } I call it using hex replacement values in a string, ie using the "\xnn" replecement method: EEPROMwrite(,addr, "\xFF\x00\x01",3); Now, if a "\x" replacement in the string contains FF (or ff) , the hex value read \ printed is 00 .. BUT if the value is preceded by another value (which is not 00 or FF), eg, EEPROMwrite(,addr, "\01\xFF\x00",3); ... it correctly reads \ prints the hesx value as FF! To be clear, EEPROMwrite(,addr, "\00\xFF\x00",3); ... does NOT print out FF, as the preceding value is 00.. I have checked the web and this does not seem to be expected behaviour - can you look into it please?
  8. Thanks Reynard, but that was my first thought too! (I have been caught before with that one...). If I play with the compiler, I can see some CPUs with values which agree with the data sheets, and others which do not - even though the data sheets are all specifying "Flash (bytes)", not "instructions. Also, some TDF files agree with the associated data sheets (eg 44K22), while the TDF for 66K22 does not agree - so there is some inconsistency worth checking! I have had a situation where the compiler says "all OK, only used just over 50% program memory" while MPLAB wont load the hex file into the CPU properly because its too big.... As an example, my current project uses 66K22: the compiler is saying "ROM available 131072 bytes, ROM used 34774 bytes (26.1%)". But if I look at the program area of the hex file in MPLAB, it has a limit of 0xFFFF (65536 bytes) and has code up to 0x87D6 (which is the 34774 bytes specified by the compiler). Clearly not 26% utilisation..... more like 53%.... compiler is wrong....
  9. In SourceBoostC ver 730, I have noticed that some 18Fxx'K'yy CPUs are returning the wrong program memory size in the IDE (it is often 2x correct value). Examples: 66K22, 67K22. If I look in the .tdf files for these CPUs, the same "incorrect" values are present as the program memory ranges. The values are 2 x the size shown in the CPU data sheet. This leads to the IDE \ compiler stats being incorrect after a compile (eg, "ROM available:", "used:" and "free:" figures) I have checked a "correct" CPU tdf (eg, 44K22) and the size agrees with the data sheet, and is displayed correctly in the IDE... Am i missing something about the "factor of 2" on these CPUs? Or is this just a plain and simple error? (It has turned up on other CPUs too - I will list as I come across them again...) This may be "old news" now that Chameleon is out, but other users may still be working on 730 and it may be that the error has carried over into the new compiler support files....
  10. I am planning a project for a customer targetting PIC 18F67K40. This CPU doesn't appear to be supported in the current release (7.30). Can you please provide an update to allow me to use this part? In general, how is BoostC tracking the appearance of new processors? Is anybody producing new support files for them? Either within the Sourceboost company or the community? Is there some other community support site that I should be looking at? (I have in the past edited the _PIC18Fxxx.TDF, map.txt and other include files, to add a CPU, but its a tricky process - is there a guide published for "how to" add a CPU to the list? Or could you write one? Or should I write one based on what i have done in the past for you to edit?) Is there a mechanism for users to contribute "mods" they have made for new CPUs, so they can be sent back into the community? Still using your product after many years (back to early 6.xx) - many thanks for a great little compiler & IDE. Just wish you would do a PIC32MX one...(!)
  11. It would be handy if a large Read-Only data array could be created in ROM space, to be accessed only by using the table pointer instructions. This array would have to be of a type which relaxes the array size limit of 256 bytes (on PIC18). At the moment, I can achieve this with a 'C' program I have written which reads the data I want in the large array from an 'h' file and appends extra 'S' records to the SourceBoost .hex file output. The PIC programmer then programs the target with code + data array, which can then be read with a table pointer routine. However, all this is tedious and timewasting, and especially frustrating as the original data for the large table array is in an 'h' file format anyway! Could you perhaps consider this "large Read Only array" as an addition to a future release of Sourceboost C?
  12. Regarding C compiler \ ver 7.30... are the Flash \ codespace sizes in the 18F86K22, 18F87K22 TDF files correct? They seem twice as large as the data sheet implies.... My compiler was reporting the ROM available 2 x the size the data sheet says- it also caused some problems loading the code when I exceeded the "50%" value, implying that the compiler had got it wrong. The sizes of the 85K22 and 65K22 <do> agree with the datasheet however... Please check - if I've got it wrong, my apologies !
  13. Hi, currently I have a program which uses 2 dimensional arrays to store lists of menu options. These reside in RAM, because Sourceboost wont support 2D rom arrays. (I am using SB 7.30). I now have to expand my menus and dont have the space for them in RAM - so I must re-work the code to place the data in rom. I can get around the 2D array problem with a little work - but in checking on my options in the forum, I see that someone mentioned a "single rom page limit" on rom arrays. Could you explain a little more please? Is this a limit "per "rom array" or on rom arrays, total? I could do with a more detailed explanation of rom data limits in the compiler, if you have the time... also any comments on what i am trying to do and whether the method is the best approach, etc
  14. ...erm, have just realised that there is a difference in the K20, K22 cores - they are not "functionally equivalent" - so best ignore my last post....
×