Jump to content
otofraise

First Steps With Boostc++ And Sourceboost

Recommended Posts

Hello,

 

In first, I want to congratulate you and to thank you for your work !

 

Next, and this part is less happy <_<, I would like to expose my problem :

 

I work with a PIC 18f4550 installed on a Velleman K8055 USB Experiment Interface Board.

 

To begin with your IDE and the BoostC++ compiler, I write a small "Hello world" source :

 

#include <system.h>

void main(void)
{
 //Set the PORT B on output mode
 trisb = 0x00;

 while(true)
 {
	  //Done flashing the eight leds connected to the port b
	  portb = 0x55;
	  delay_s(1);
	  portb = 0xAA;
	  delay_s(1);
 }
}

 

I select the toolsuit, the target device and I configure the clock rate in the "Settings" menu.

 

I build the project and I get a success message on the output window.

 

I upload the hex file to the PIC with an USB connection and the PDFSUSB uploader.

 

But after that, nothing is visible.

 

I have read in the BoostC++ Help file that some device configuration options need to be set with the #pragma DATA directive.

 

Do these options correspond with the informations saved in the lkr files used by the MCC18 compiler ?

 

And is it possible to transform these informations into #pragma DATA directives ?

 

Below, a sample of the content of the lkr file that I use with the MCC18 compiler :

 

CODEPAGE NAME=boot START=0x0 END=0x7FF PROTECTED

CODEPAGE NAME=vectors START=0x800 END=0x0x829 PROTECTED

 

(I have joined the complete file : rm18f4550.txt)

 

Thank you by advance

 

Best regards

 

OtO

rm18f4550.txt

Share this post


Link to post
Share on other sites

Oto

I work with a PIC 18f4550 installed on a Velleman K8055 USB Experiment Interface Board.
If your Velleman K8055 USB Experiment Interface Board has a bootloader you will probably need to relocate the code produced by the BoostC++ compiler and linker to avoid the memory used by the Bootloader. You need to add linker command line option something linke -rb 0x7FF.

 

Regards

Dave

Share this post


Link to post
Share on other sites

Hi Dave,

 

Thank you very much for your answer <_<.

 

Yes, there is a bootloader which take place from 0x000 to 0x7FF. So I need to relocate the code to 0x800.

 

I have tried it with the -rb command added to the linker option. I think it's better but, visualy, the result is the same : nothing on the leds. (I have tried too -rb 0x7FF)

 

Have you any other idea about this problem ?

 

Thank you by advance

 

Best regards

 

OtO

Share this post


Link to post
Share on other sites

Oto,

Hi Dave,

 

Thank you very much for your answer :) .

 

Yes, there is a bootloader which take place from 0x000 to 0x7FF. So I need to relocate the code to 0x800.

 

I have tried it with the -rb command added to the linker option. I think it's better but, visualy, the result is the same : nothing on the leds. (I have tried too -rb 0x7FF)

 

Have you any other idea about this problem ?

Ah yes -rb 0x800 is what you need to use as the linker command line option, not 0x7FFF - my mistake.

 

Other than that I'm not sure, is the hardware and bootloader proven?

Have you got any code you can download that works?

 

Regards

Dave

Share this post


Link to post
Share on other sites

Dave,

 

Yes, I have downloaded the same soft, builded with MCC18 on the MPLAB IDE and that works.

 

But in the main file there is that :

 

/** V E C T O R  R E M A P P I N G *******************************************/

extern void _startup (void);		// See c018i.c in your C18 compiler dir
#pragma code _RESET_INTERRUPT_VECTOR = 0x000800
void _reset (void)
{
_asm goto _startup _endasm
}
#pragma code

#pragma code _HIGH_INTERRUPT_VECTOR = 0x000808
void _high_ISR (void)
{
  ;
}

#pragma code _LOW_INTERRUPT_VECTOR = 0x000818
void _low_ISR (void)
{
  ;
}
#pragma code

 

I have attached too the c018i.c file.

 

I have tried to insert these lines into my code but the compilator doesn't like :

_asm goto _startup _endasm

 

Do I have to add these lines and link the c018i.o file with the project ?

 

Best regards

 

OtO

c018i.txt

Share this post


Link to post
Share on other sites

I have crawled on these forums for a few months now, debating whether I should register or not. This post was my breaking point since I know a problem similar to this all too well.

 

I could not get my "Hello, World!" function to work with SourceBoost, but I could with MpLab. The problem was that I was still new to microcontroller programming and I didn't know about CONFIG bits.

 

If you look in the datasheet for the PIC18F4550 on page 290, there is a bit called WDTEN. This bit is set by default, enabling the watchdog timer (WDT). The WDT constantly runs in the background of the PIC, and it resets the PIC whenever it overflows. This helps to prevent the PIC from hanging on one instruction is an error occurs or if there is an infinite loop. The WDT must be cleared manually in software. clear_wdt() does this in SourceBoost.

 

Either add clear_wdt to your while loop, or just disable the WDT using "#pragma DATA" etc.

 

The WDT is one of the reasons that every time I write code, I add #pragmas to the beginning to manually set every CONFIG bit my particular PIC has.

 

SourceBoost will leave the default CONFIG bits, but MpLab tends to change them to shut everything off by default rather than using hardware defaults.

 

This may or may not work for you because I don't kow about your bootloader. I tend not to use them. In any case, I hope this will help somewhat.

 

- Bill

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...