Editing BoostC tiny Wiki
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 2: | Line 2: | ||
This is the very beginning of a Wiki for BoostC. Its organization will probably change a lot in the near future ( if we can get the free labor required ). It may move to the SourceBoost site if they want to host it. Since BoostC is proprietary it may be inappropriate for it to grow too big here unless we can find some explicit support for it. For now here it is. Much of this material applies to compilers other than BoostC and to environments other than PICs embedded systems. Major sections will probably be split into seperate pages. [http://www.sourceboost.com/ SourceBoost Homepage] | This is the very beginning of a Wiki for BoostC. Its organization will probably change a lot in the near future ( if we can get the free labor required ). It may move to the SourceBoost site if they want to host it. Since BoostC is proprietary it may be inappropriate for it to grow too big here unless we can find some explicit support for it. For now here it is. Much of this material applies to compilers other than BoostC and to environments other than PICs embedded systems. Major sections will probably be split into seperate pages. [http://www.sourceboost.com/ SourceBoost Homepage] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Tips/Tricks/Gotchas == | == Tips/Tricks/Gotchas == | ||
Line 42: | Line 19: | ||
=== Flakey Stack === | === Flakey Stack === | ||
− | If a program is flakey, | + | If a program is flakey, partarcularly after working in earlier versions you may have run out of stack space for the call return stack. |
− | To help you tell | + | To help you tell look at all the linker messages. Also open the code window and look at the call tree ( View -> Code Bar -> Call Tree ), see anything in red? |
The fix: | The fix: | ||
Line 54: | Line 31: | ||
=== Bad Options === | === Bad Options === | ||
− | Check you options, target should be right. Recently I had a problem with the Compiler location option. It seems to be a option of the project ( which makes sense if you want different projects to behave differently ) not the ide installation, so especially if you got the project from someone else check it. For me a bad compiler location made the build take forever and do nothing | + | Check you options, target should be right. Recently I had a problem with the Compiler location option. It seems to be a option of the project ( which makes sense if you want different projects to behave differently ) not the ide installation, so especially if you got the project from someone else check it. For me a bad compiler location made the build take forever and do nothing, the compile gave a useful error message. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Standard C Issues == | == Standard C Issues == | ||
Line 90: | Line 41: | ||
[http://en.wikipedia.org/wiki/C_Traps_and_Pitfalls C Traps and Pitfalls From Wikipedia, the free encyclopedia] Note that there is a free download or a longer ( for purchase ) book. | [http://en.wikipedia.org/wiki/C_Traps_and_Pitfalls C Traps and Pitfalls From Wikipedia, the free encyclopedia] Note that there is a free download or a longer ( for purchase ) book. | ||
− | === Good | + | === Good Pratices === |
Opinions may differ! | Opinions may differ! | ||
Line 114: | Line 65: | ||
char ix; | char ix; | ||
− | The reader, and perhaps even the programmer may not remember the default or | + | The reader, and perhaps even the programmer may not remember the default or remeber it correctly |
− | Use | + | Use parenthsis not operation conventions: |
c = a + ( b * c ) | c = a + ( b * c ) | ||
Line 124: | Line 75: | ||
c = a + b * c | c = a + b * c | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==== Read This ==== | ==== Read This ==== | ||
[http://www.csd.uoc.gr/~hy255/reading/cstyle.pdf Recommended C Style and Coding Standards] from Bell Labs | [http://www.csd.uoc.gr/~hy255/reading/cstyle.pdf Recommended C Style and Coding Standards] from Bell Labs | ||
− | |||
− | |||
− | |||
− | |||
== Optimization == | == Optimization == | ||
Line 166: | Line 90: | ||
*Is shifting better than multiplying/dividing by poweres of 2? | *Is shifting better than multiplying/dividing by poweres of 2? | ||
− | *does if( intcon & (1<<T0IF) ) work better than test_bit( intcon, T0IF )? | + | *does if( intcon & (1<<T0IF) ) work better than test_bit( intcon, T0IF )? |
*Is there a time penality to using local variables. | *Is there a time penality to using local variables. | ||
Line 176: | Line 100: | ||
=== Optimizations that Seem Not to Work === | === Optimizations that Seem Not to Work === | ||
− | |||
− | |||
− | |||
− | + | == Code Snips that may Be Helpful == | |
− | + | You are counting down and want to know when an unsigned number goes negative ( never ). You could declare it signed, slowing everything down. Instead check against FF. This assumes you do not use FF on the positive side. | |
− | + | if ( ix == 0xFF ) .. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Example Programs and Projects == | == Example Programs and Projects == | ||
Go to [[PIC Links]] and search ( page search not google ) on "BoostC". | Go to [[PIC Links]] and search ( page search not google ) on "BoostC". | ||
− | |||
− | |||
− | |||
− | |||
== Further reading == | == Further reading == | ||
Line 217: | Line 118: | ||
* [[Microcontrollers]] This Wiki's main page on microcontrollers including the PIC. | * [[Microcontrollers]] This Wiki's main page on microcontrollers including the PIC. | ||
− | * [[Playing With PIC Pack]] A user | + | * [[Playing With PIC Pack]] A user develope package in BoostC for the PIC. |
− | * [[BoostC from the | + | * [[BoostC from the Fourm]] Information extracted and summarized from the BoostC Forum. |
* [http://en.wikibooks.org/wiki/C_programming Wikibooks: C programming] is about C programming in general (alas, focuses on programs running on desktop computers, rather than small microcontrollers). | * [http://en.wikibooks.org/wiki/C_programming Wikibooks: C programming] is about C programming in general (alas, focuses on programs running on desktop computers, rather than small microcontrollers). | ||
− | |||
− | |||
− |