| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| WalkOver 
 
 
 Joined: 14 May 2021
 Posts: 24
 
 
 
			    
 
 | 
			
				| PCD Bootloader and application from other compiler |  
				|  Posted: Wed Aug 04, 2021 11:03 am |   |  
				| 
 |  
				| 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
  |  | 
	
		|  | 
	
		| WalkOver 
 
 
 Joined: 14 May 2021
 Posts: 24
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Aug 04, 2021 12:37 pm |   |  
				| 
 |  
				| 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
  |  | 
	
		|  | 
	
		| dyeatman 
 
 
 Joined: 06 Sep 2003
 Posts: 1968
 Location: Norman, OK
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Aug 04, 2021 12:39 pm |   |  
				| 
 |  
				| 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
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Aug 04, 2021 12:50 pm |   |  
				| 
 |  
				| This why I migrated from MikroC to CCS   
 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
  |  | 
	
		|  | 
	
		| Ttelmah 
 
 
 Joined: 11 Mar 2010
 Posts: 19967
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Thu Aug 05, 2021 1:30 am |   |  
				| 
 |  
				| 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
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Thu Aug 05, 2021 2:35 am |   |  
				| 
 |  
				| Hello, thank you for your help   
 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
  |  | 
	
		|  | 
	
		| Ttelmah 
 
 
 Joined: 11 Mar 2010
 Posts: 19967
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Thu Aug 05, 2021 10:39 am |   |  
				| 
 |  
				| try hex2bin then bin2hex. Remembering what tools I used is hard sometimes!.
 |  | 
	
		|  | 
	
		| asmallri 
 
 
 Joined: 12 Aug 2004
 Posts: 1660
 Location: Perth, Australia
 
 
			        
 
 | 
			
				|  |  
				|  Posted: Sun Aug 08, 2021 3:42 am |   |  
				| 
 |  
				|  	  | WalkOver wrote: |  	  | Hello, thank you for your help   
 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
  | 
 
 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!!
 |  | 
	
		|  | 
	
		|  |