Editing BoostC from the Fourm
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
− | This is the extraction of useful info on BoostC from its forum | + | This is the extraction of useful info on BoostC from its forum. Each extract starts with a link to the foum thered, read it in full if you wish. I have removed names and edited the text in a way that I hope makes it more readable. It is just a forum, the postings may be outright wrong, or out of date. The final product is mine ( I am responsible for posting the material ( check page history), I claim no ownership, nor am I responsible for the accuracy of the material or your results using it. ) If you object let me [russ_hensel] know, or fix it yourself. It is a wiki so others than [russ_hensel] may have added/edited the content. Not included: |
* Things unresolved: | * Things unresolved: | ||
Line 7: | Line 7: | ||
* Compiler issues that should have been fixed by now or soon | * Compiler issues that should have been fixed by now or soon | ||
* Most hardware issues | * Most hardware issues | ||
− | * Things that i | + | * Things that i thnik are covered in the manual |
* Documentation of most things you cannot do. | * Documentation of most things you cannot do. | ||
* Notices of projects, websites.... we should have these in the [[PIC Links]] or some other place. | * Notices of projects, websites.... we should have these in the [[PIC Links]] or some other place. | ||
Line 13: | Line 13: | ||
== 2008 Extracts == | == 2008 Extracts == | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3909&pid=14605&mode=threaded&start=#entry14605 | * From: http://forum.sourceboost.com/index.php?showtopic=3909&pid=14605&mode=threaded&start=#entry14605 | ||
Line 29: | Line 28: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3896 | * From: http://forum.sourceboost.com/index.php?showtopic=3896 | ||
Line 37: | Line 35: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3895&pid=14515&mode=threaded&start=#entry14515 | * From: http://forum.sourceboost.com/index.php?showtopic=3895&pid=14515&mode=threaded&start=#entry14515 | ||
Line 43: | Line 40: | ||
(*Not* the current date and time at run-time). | (*Not* the current date and time at run-time). | ||
− | + | CODE | |
char time[] = __TIME__; // "16:38:53" | char time[] = __TIME__; // "16:38:53" | ||
char date[] = __DATE__; // "Nov 30 2008" | char date[] = __DATE__; // "Nov 30 2008" | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3877&pid=14436&mode=threaded&start=#entry14436 | * From: http://forum.sourceboost.com/index.php?showtopic=3877&pid=14436&mode=threaded&start=#entry14436 | ||
− | Question: I can understand that the isr may interrupt the 'main loop' at any point and hence (global) variables may be in a | + | Question: I can understand that the isr may interrupt the 'main loop' at any point and hence (global) variables may be in a inderterminate state, but why can't functions be used in both isr and main routines. |
Surely the sw stack is used for 'main' and 'interrupt' functions, so local vars so they should be safe while the isr is running?? | Surely the sw stack is used for 'main' and 'interrupt' functions, so local vars so they should be safe while the isr is running?? | ||
Line 60: | Line 56: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3871&pid=14426&mode=threaded&start=#entry14426 | * From: http://forum.sourceboost.com/index.php?showtopic=3871&pid=14426&mode=threaded&start=#entry14426 | ||
Line 72: | Line 67: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3862&pid=14378&mode=threaded&start=#entry14378 | * From: http://forum.sourceboost.com/index.php?showtopic=3862&pid=14378&mode=threaded&start=#entry14378 | ||
Line 92: | Line 86: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3762&pid=14225&mode=threaded&start=#entry14225 | * From: http://forum.sourceboost.com/index.php?showtopic=3762&pid=14225&mode=threaded&start=#entry14225 | ||
Line 99: | Line 92: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3854&pid=14343&mode=threaded&start=#entry14343 | * From: http://forum.sourceboost.com/index.php?showtopic=3854&pid=14343&mode=threaded&start=#entry14343 | ||
− | + | To build (compile) a library, goto "Settings -> Options...", select Output Type: Library radio button. | |
To add a library to your project, goto the Workspace (project) window (left of screen usually), right click and add the .lib file you want to include. | To add a library to your project, goto the Workspace (project) window (left of screen usually), right click and add the .lib file you want to include. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
I think left out a subtle point in that most libraries need not only a .lib but also a .h which defines the function prototypes that the library contains. Then, the user of the library would also #include the .h file in the source that is using it so that the compiler knows what to expect. This is the same as if you have multiple files in a stand-alone compile. | I think left out a subtle point in that most libraries need not only a .lib but also a .h which defines the function prototypes that the library contains. Then, the user of the library would also #include the .h file in the source that is using it so that the compiler knows what to expect. This is the same as if you have multiple files in a stand-alone compile. | ||
Line 124: | Line 107: | ||
You now have your .h file to match your .lib file. | You now have your .h file to match your .lib file. | ||
+ | |||
+ | Remember: If you use #include <test.h> , the compiler expects the .h file to be in the ...\SourceBoost\include directory. | ||
+ | Use #include "test.h" if the header is in your local project directory. Or just use the full path name. | ||
− | |||
− | |||
* From http://forum.sourceboost.com/index.php?showtopic=2704&pid=14026&mode=threaded&start=#entry14026 | * From http://forum.sourceboost.com/index.php?showtopic=2704&pid=14026&mode=threaded&start=#entry14026 | ||
Line 134: | Line 118: | ||
− | |||
* From http://forum.sourceboost.com/index.php?showtopic=3687&pid=13897&mode=threaded&show=&st=0 | * From http://forum.sourceboost.com/index.php?showtopic=3687&pid=13897&mode=threaded&show=&st=0 | ||
Line 141: | Line 124: | ||
− | |||
* From http://forum.sourceboost.com/index.php?showtopic=3689&pid=13901&mode=threaded&start=#entry13901 | * From http://forum.sourceboost.com/index.php?showtopic=3689&pid=13901&mode=threaded&start=#entry13901 | ||
− | This looks like well documented but included as a | + | This looks like well documented but included as a goctgha. |
Have you tried reading the GPIO ports before clearing the interrupt flag GPIF? The port has to be read to end the change mismatch condition otherwise GPIF will just set itself again (page 21 of data sheet). | Have you tried reading the GPIO ports before clearing the interrupt flag GPIF? The port has to be read to end the change mismatch condition otherwise GPIF will just set itself again (page 21 of data sheet). | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3591&pid=13546&mode=threaded&start=#entry13546 | * From: http://forum.sourceboost.com/index.php?showtopic=3591&pid=13546&mode=threaded&start=#entry13546 | ||
+ | |||
...Is it not possible to get quick access to bits in an array?... No it's not. You have to use good old bitwise operators. | ...Is it not possible to get quick access to bits in an array?... No it's not. You have to use good old bitwise operators. | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3670&pid=13847&mode=threaded&start=#entry13847 | * From: http://forum.sourceboost.com/index.php?showtopic=3670&pid=13847&mode=threaded&start=#entry13847 | ||
Line 160: | Line 141: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3669&pid=13792&mode=threaded&start=#entry13792 | * From: http://forum.sourceboost.com/index.php?showtopic=3669&pid=13792&mode=threaded&start=#entry13792 | ||
Line 166: | Line 146: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3649&pid=13765&mode=threaded&start=#entry13765 | * From: http://forum.sourceboost.com/index.php?showtopic=3649&pid=13765&mode=threaded&start=#entry13765 | ||
Line 173: | Line 152: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3658&pid=13746&mode=threaded&start=#entry13746 | * From: http://forum.sourceboost.com/index.php?showtopic=3658&pid=13746&mode=threaded&start=#entry13746 | ||
Line 180: | Line 158: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3644&pid=13713&mode=threaded&start=#entry13713 | * From: http://forum.sourceboost.com/index.php?showtopic=3644&pid=13713&mode=threaded&start=#entry13713 | ||
Line 186: | Line 163: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3588&pid=13562&mode=threaded&start=#entry13562 | * From: http://forum.sourceboost.com/index.php?showtopic=3588&pid=13562&mode=threaded&start=#entry13562 | ||
Line 192: | Line 168: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3602&pid=13596&mode=threaded&start=#entry13596 | * From: http://forum.sourceboost.com/index.php?showtopic=3602&pid=13596&mode=threaded&start=#entry13596 | ||
Line 198: | Line 173: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3598&pid=13576&mode=threaded&start=#entry13576 | * From: http://forum.sourceboost.com/index.php?showtopic=3598&pid=13576&mode=threaded&start=#entry13576 | ||
Line 204: | Line 178: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3593&pid=13553&mode=threaded&start=#entry13553 | * From: http://forum.sourceboost.com/index.php?showtopic=3593&pid=13553&mode=threaded&start=#entry13553 | ||
− | + | The problem is that Debug Express reserves RAM, as well as some program memory, for its own use. e.g. on the 16F887 it reserves 0x070, 0x0f0, 0x165 to 0x170 inclusive and 0x1f0. (These are shown as RR in the MPLAB IDE file registers window). On larger projects requiring more RAM BoostC has no knowledge of these reserved locations and simply overwrites them. Does anyone know the best way, if there is one, of reserving these or any other locations to prevent them being used by BoostC? Declare fixed address variables at the locations you want to protect. BoostLink will work around any fixed address variables. | |
− | |||
− | |||
− | Declare fixed address variables at the locations you want to protect. BoostLink will work around any fixed address variables. | ||
Something like this would fit the bill: | Something like this would fit the bill: | ||
Line 222: | Line 192: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3591&pid=13546&mode=threaded&start=#entry13546 | * From: http://forum.sourceboost.com/index.php?showtopic=3591&pid=13546&mode=threaded&start=#entry13546 | ||
Line 229: | Line 198: | ||
The "<<", ">>", "&", and "|" operators. | The "<<", ">>", "&", and "|" operators. | ||
− | |||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3590&pid=13539&mode=threaded&start=#entry13539 | * From: http://forum.sourceboost.com/index.php?showtopic=3590&pid=13539&mode=threaded&start=#entry13539 | ||
When a project contains multiple source files, is there a way to compile a single file? You can try using "Project -> Quick", then select the source (.c) file you are interested in, and a mini project will be created containing only that single file. When you are done, just delete the mini project file and go back to the main project. | When a project contains multiple source files, is there a way to compile a single file? You can try using "Project -> Quick", then select the source (.c) file you are interested in, and a mini project will be created containing only that single file. When you are done, just delete the mini project file and go back to the main project. | ||
− | |||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3587&pid=13523&mode=threaded&start=#entry13523 | * From: http://forum.sourceboost.com/index.php?showtopic=3587&pid=13523&mode=threaded&start=#entry13523 | ||
Line 257: | Line 222: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3577&pid=13494&mode=threaded&start=#entry13494 | * From: http://forum.sourceboost.com/index.php?showtopic=3577&pid=13494&mode=threaded&start=#entry13494 | ||
Line 263: | Line 227: | ||
− | |||
*From: http://forum.sourceboost.com/index.php?showtopic=3574&pid=13469&mode=threaded&start=#entry13469 | *From: http://forum.sourceboost.com/index.php?showtopic=3574&pid=13469&mode=threaded&start=#entry13469 | ||
Line 278: | Line 241: | ||
− | |||
*From: http://forum.sourceboost.com/index.php?showtopic=3570&pid=13455&mode=threaded&start=#entry13455 | *From: http://forum.sourceboost.com/index.php?showtopic=3570&pid=13455&mode=threaded&start=#entry13455 | ||
Line 286: | Line 248: | ||
− | |||
*From: http://forum.sourceboost.com/index.php?showtopic=3571&pid=13459&mode=threaded&start=#entry13459 | *From: http://forum.sourceboost.com/index.php?showtopic=3571&pid=13459&mode=threaded&start=#entry13459 | ||
− | The | + | The libary code for one wire library use the nop() instruction. They should rewrite this lib becasue now it´s not working with different clock frequency. A work around is to run goodies if you have pro licens and change the code your self. Or you can download the lib code from lika.be |
Not sure about the above, you many want to see the original post | Not sure about the above, you many want to see the original post | ||
− | |||
*From: http://forum.sourceboost.com/index.php?showtopic=3566&pid=13440&mode=threaded&start=#entry13440 | *From: http://forum.sourceboost.com/index.php?showtopic=3566&pid=13440&mode=threaded&start=#entry13440 | ||
Line 331: | Line 291: | ||
− | + | ||
* From: http://forum.sourceboost.com/index.php?showtopic=3556 | * From: http://forum.sourceboost.com/index.php?showtopic=3556 | ||
Line 349: | Line 309: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3496 | * From: http://forum.sourceboost.com/index.php?showtopic=3496 | ||
Line 355: | Line 314: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3494&pid=13143&mode=threaded&start=#entry13143 | * From: http://forum.sourceboost.com/index.php?showtopic=3494&pid=13143&mode=threaded&start=#entry13143 | ||
Line 361: | Line 319: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3491&pid=13139&mode=threaded&start=#entry13139 | * From: http://forum.sourceboost.com/index.php?showtopic=3491&pid=13139&mode=threaded&start=#entry13139 | ||
Line 371: | Line 328: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3489&pid=13124&mode=threaded&start=#entry13124 | * From: http://forum.sourceboost.com/index.php?showtopic=3489&pid=13124&mode=threaded&start=#entry13124 | ||
Line 379: | Line 335: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3199 | * From: http://forum.sourceboost.com/index.php?showtopic=3199 | ||
Line 385: | Line 340: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3475&pid=13043&mode=threaded&start=#entry13043 | * From: http://forum.sourceboost.com/index.php?showtopic=3475&pid=13043&mode=threaded&start=#entry13043 | ||
Line 403: | Line 357: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3484&pid=13085&mode=threaded&start=#entry13085 | * From: http://forum.sourceboost.com/index.php?showtopic=3484&pid=13085&mode=threaded&start=#entry13085 | ||
Line 411: | Line 364: | ||
− | + | ||
* From: http://forum.sourceboost.com/index.php?showtopic=3473&pid=13038&mode=threaded&start=#entry13038 | * From: http://forum.sourceboost.com/index.php?showtopic=3473&pid=13038&mode=threaded&start=#entry13038 | ||
Line 419: | Line 372: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3472&pid=13035&mode=threaded&show=&st=#entry13035 | * From: http://forum.sourceboost.com/index.php?showtopic=3472&pid=13035&mode=threaded&show=&st=#entry13035 | ||
Line 425: | Line 377: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3438 | * From: http://forum.sourceboost.com/index.php?showtopic=3438 | ||
+ | |||
discussion of functions in interrupts, debouncing in various ways, see the post. | discussion of functions in interrupts, debouncing in various ways, see the post. | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3463 | * From: http://forum.sourceboost.com/index.php?showtopic=3463 | ||
Line 438: | Line 389: | ||
--------- | --------- | ||
+ | |||
* From: | * From: | ||
Line 453: | Line 405: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=2802&pid=10768&mode=threaded&start=#entry10768 | * From: http://forum.sourceboost.com/index.php?showtopic=2802&pid=10768&mode=threaded&start=#entry10768 | ||
Line 459: | Line 410: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3457&pid=12979&mode=threaded&start=#entry12979 | * From: http://forum.sourceboost.com/index.php?showtopic=3457&pid=12979&mode=threaded&start=#entry12979 | ||
Line 465: | Line 415: | ||
− | |||
* From: http://forum.sourceboost.com/index.php?showtopic=3455&pid=12946&mode=threaded&start=#entry12946 | * From: http://forum.sourceboost.com/index.php?showtopic=3455&pid=12946&mode=threaded&start=#entry12946 | ||
Line 472: | Line 421: | ||
Answer: Put your source files in a new directory(or not).Open MPLAB, start a new project(project(new)), give it a name, tell it the directory where your files are located. This will create the project. Now add your files. You'll need to make sure you point MPLAB to your compiler and linker(project(add language toolsuite)). Ctrl+F10(build) | Answer: Put your source files in a new directory(or not).Open MPLAB, start a new project(project(new)), give it a name, tell it the directory where your files are located. This will create the project. Now add your files. You'll need to make sure you point MPLAB to your compiler and linker(project(add language toolsuite)). Ctrl+F10(build) | ||
− | == 2007 Extract == | + | == 2007 Extract, will I ever get here == |
[[BoostC Forum Extracts 2007]] | [[BoostC Forum Extracts 2007]] | ||
+ | |||
+ | http://forum.sourceboost.com/index.php?showtopic=3444&pid=12904&mode=threaded&start=#entry12904 | ||
+ | |||
+ | |||
+ | |||
+ | A macro like MAKESHORT can initialize a variable but the compiler does not know that and generates a warning. Is there a way to solve this without initializing the variable explicitly? | ||
+ | |||
+ | Frederic Interested in advertising here? Contact support@sourceboost.com | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | FredericG, | ||
+ | QUOTE (FredericG @ Dec 30 2007, 06:59 PM) | ||
+ | A macro like MAKESHORT can initialize a variable but the compiler does not know that and generates a warning. Is there a way to solve this without initializing the variable explicitly? | ||
+ | Please provide an example of what you mean exactly. | ||
+ | |||
+ | Regards | ||
+ | Dave | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | s | ||
+ | u16_t timestamp; | ||
+ | |||
+ | t1con.TMR1ON = 0; // stop timer | ||
+ | MAKESHORT(timestamp, tmr1l, tmr1h); | ||
+ | |||
+ | en_of_pulse = timestamp; <<==== causes warning | ||
+ | |||
+ | QUOTE | ||
+ | It's not the macro that's the problem, but the inline assembly it uses. The compiler doesn't notice if you set a variable with inline assembly statements and warns that it's possibly uninitialized. Declaring the variable as 'volatile' gets rid of the warning, but isn't a great solution as you might miss a true 'uninitialized' case. | ||
+ | |||
+ | I am not an expert, but I think I have seen compilers that have pragma's that give hints to compiler about these things. | ||
+ | Thanks for the workaround, I can for sure live with that solution | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ----------------- | ||
+ | |||
+ | http://forum.sourceboost.com/index.php?showtopic=3430&pid=12890&mode=threaded&start=#entry12890 | ||
+ | |||
+ | |||
+ | Whah, this doesn't work! | ||
+ | |||
+ | CODE | ||
+ | typedef struct { | ||
+ | char foo[11]; | ||
+ | bar_enum bar; | ||
+ | } baz_list; | ||
+ | |||
+ | baz_list baz[] = { "0123456789", quux, | ||
+ | "0123456789", quuux, | ||
+ | "0123456789", quuuux | ||
+ | }; | ||
+ | |||
+ | |||
+ | I can create a two dimensional array of strings and initialize them or a array of enums and initialize them but not an array of structs, and that sucks!!! (rhyme intended) | ||
+ | |||
+ | Any suggestions??? | ||
+ | |||
+ | Jacob | ||
+ | BoostC 6.81 | ||
+ | |||
+ | This post has been edited by Jacob Christ: Dec 23 2007, 12:23 AM Interested in advertising here? Contact support@sourceboost.com | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Replies twomers Dec 27 2007, 05:04 PM | ||
+ | Post #2 | ||
+ | |||
+ | |||
+ | Regular | ||
+ | |||
+ | |||
+ | Group: EstablishedMember | ||
+ | Posts: 42 | ||
+ | Joined: 28-November 07 | ||
+ | From: Ireland | ||
+ | Member No.: 3,919 | ||
+ | |||
+ | |||
+ | A more premitive question to ask would be why: | ||
+ | |||
+ | CODE | ||
+ | struct thing { | ||
+ | char ch_1; | ||
+ | char ch_2; | ||
+ | }; | ||
+ | |||
+ | struct thing thingy = {2,2}; | ||
+ | |||
+ | |||
+ | doesn't work. | ||
+ | |||
+ | I can't find the thread I'm thinking of but I believe you're going to have to assign the values yourself. I'd say use an inline function or something to make it look neater: | ||
+ | |||
+ | CODE | ||
+ | struct thing { | ||
+ | char ch_1; | ||
+ | char ch_2; | ||
+ | }; | ||
+ | |||
+ | inline void set_thing( struct thing &i_thing, | ||
+ | unsigned char ch_1, | ||
+ | unsigned char ch_2 ) { | ||
+ | i_thing.ch_1 = ch_1; | ||
+ | i_thing.ch_2 = ch_2; | ||
+ | } | ||
+ | |||
+ | void main( void ){ | ||
+ | struct thing i_thing[3]; | ||
+ | set_thing( i_thing[0], 2, 3 ); | ||
+ | set_thing( i_thing[1], 5, 3 ); | ||
+ | set_thing( i_thing[2], 1, 9 ); | ||
+ | |||
+ | // Or if you wish | ||
+ | // i_thing[0].ch_1 = 2; i_thing[0].ch_2 = 3; | ||
+ | // i_thing[1].ch_1 = 5; i_thing[1].ch_2 = 3; | ||
+ | // i_thing[2].ch_1 = 1; i_thing[2].ch_2 = 9; | ||
+ | } | ||
+ | |||
+ | |||
+ | Found the thread - http://forum.sourceboost.com/index.php?showtopic=3404 |