CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PCD Bootloader and application from other compiler

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
WalkOver



Joined: 14 May 2021
Posts: 24

View user's profile Send private message

PCD Bootloader and application from other compiler
PostPosted: Wed Aug 04, 2021 11:03 am     Reply with quote

Hello,

I would like to implement a serial bootloader to an application compiled with another compiler ( MikroC from MikroElektronika ).

I tried to compile the CCS bootloader exemple for my target MCU ( dsPIC33EP512MU810 ) and it works like a charm with a program compiled with CCS ( and the directive #include <pcd_bootloader.h> at the top of my code ).

But now, I would like to load a program compiled with MikroC and I have two issues.

1- the first one is with a simple test program compiled with MikroC, there is an error at the end of the downloading process " output buffer too small for block".
It is an error I don't have with a test program compiled with CCS.

2- I have to relocate the code compiled with MikroC to avoid overwriting the bootloader but I don't know how to ( org/orgall directive ? ) and how to compute the right address ?

Any help is welcome Smile
WalkOver



Joined: 14 May 2021
Posts: 24

View user's profile Send private message

PostPosted: Wed Aug 04, 2021 12:37 pm     Reply with quote

Hello again,

I printed out the variable "APPLICATION_START" computed by the pcd_bootloader program and it return "4096" or 0x1000

So I used the directive "#pragma orgall 0x1000" on the top of my program compiled by MikroC. The directive works well because I can see that the reallocation is working with my programmer software.

But I still have the exact same issues described in the first post Embarassed
dyeatman



Joined: 06 Sep 2003
Posts: 1910
Location: Norman, OK

View user's profile Send private message

PostPosted: Wed Aug 04, 2021 12:39 pm     Reply with quote

Hi, You may not find anyone here versed in Mikro C. I have their compiler but rarely use it. Most of mine is done in CCS.

I would recommend using their discussion groups or contact Mikro tech Support.

One of the outstanding things about CCS is their user support group. Many of
the other compilers don't have such an active (or experienced/proficient)User
Group
_________________
Google and Forum Search are some of your best tools!!!!
WalkOver



Joined: 14 May 2021
Posts: 24

View user's profile Send private message

PostPosted: Wed Aug 04, 2021 12:50 pm     Reply with quote

This why I migrated from MikroC to CCS Very Happy

My third problem is my very low level of programming knowledge.

I have a program under mikroC that I can't convert under CCS ( because of my low level knowledge....and it is working well on MikroC ).

Just want to add a serial bootloader. On the MikroC forum, I will have the same reaction as you, address me to the CCS forum Twisted Evil
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Thu Aug 05, 2021 1:30 am     Reply with quote

I'd suspect you have actually fixed your #2 error with orgall. The remaining
problem is the hex output format being used. It sounds as if MikroC is actually
generating long lines in the hex output. You would need to go through the
manuals and see if there are any options to limit the line length being sent.
I think you will find there is an option in MikroC to select standard Intel
Hex, or Long Intel Hex. This needs to be set to standard to be compatible
with the bootloader.
One alternative I have used in a similar situation, is to take the output
file, and run hex2bin, then on the output file from this run bin2mot (you
need to download both of these). This then converts the file to 'standard'
Intel Hex format.
WalkOver



Joined: 14 May 2021
Posts: 24

View user's profile Send private message

PostPosted: Thu Aug 05, 2021 2:35 am     Reply with quote

Hello, thank you for your help Smile

I have to dig a bit more.

There are options in the output settings of MikroC compiler but "long hex format" wasn't checked.

I tried with and without this setting but I still have the issue.
I tried with hex2bin and mot2bin but I definitely need to specify parameters.

hex2bin seems to working well but I have error during mot2bin conversion Mad
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Thu Aug 05, 2021 10:39 am     Reply with quote

try hex2bin then bin2hex.
Remembering what tools I used is hard sometimes!.
asmallri



Joined: 12 Aug 2004
Posts: 1630
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sun Aug 08, 2021 3:42 am     Reply with quote

WalkOver wrote:
Hello, thank you for your help Smile

I have to dig a bit more.

There are options in the output settings of MikroC compiler but "long hex format" wasn't checked.

I tried with and without this setting but I still have the issue.
I tried with hex2bin and mot2bin but I definitely need to specify parameters.

hex2bin seems to working well but I have error during mot2bin conversion Mad


There is another option that I sometimes use when I need a standard hex file output. I use MPLAB or IPE to load the hex file of interest in the PC's memory and then I export to a hex file. This produces a standard intel hex file output that does not have a lot of the artifacts you see produced by some compilers.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group