bloader and ht-picc

Support for Bloader and Screamer

Moderator: phalanx

Postby cbatters » Tue May 10, 2005 3:54 am

FlipFlops wrote:acrimu,

acmailtwoATrogers.ca bounces for me (and yes, I know to replace AT with @).

I didn't see this offered before, but I noticed that the HT PICC manual lists the -a option:

The -A option is used to specify a base address for the ROM image. This option may be required with debugging tools that expect the ROM image to begin at an address other than zero. This option effects all ROM-based psects including interrupt vectors and constant data as well as code.

I know that putting -a0004h in the linker settings will allow Screamer to download to the PIC.

I'm desperate to find a solution for using HT PICC with Bloader and interrupts! :(


IMHO, "correct" solution is to modify Bloader/Screamer so they don't require any BS with "Bumping" the code.


Clint


Clint
cbatters
 
Posts: 65
Joined: Tue Jun 01, 2004 11:45 am

Postby FlipFlops » Tue May 10, 2005 7:13 am

Perhaps, but I'm not that skilled at this stuff yet. :D

Right now I'm running into a problem with PICC avoiding certain sections of the program memory space for no particular reason. My psect usage map and memory usage maps show:

Code: Select all
Psect Usage Map:

Psect     | Contents                     | Memory Range
----------|------------------------------|--------------------
powerup   | Power on reset code          | $0004 - $0007
intentry  | Interrupt service routine    | $0008 - $000E
intcode   | Interrupt service routine    | $000F - $0043
intret    | Interrupt service routine    | $0044 - $004A
init      | Initialization code          | $004B - $004E
end_init  | Initialization code          | $004F - $0051
clrtext   | Memory clearing code         | $0052 - $0058
text19    | Program and library code     | $01E8 - $04A8
text      | Program and library code     | $04A9 - $07FF
text10    | Program and library code     | $0D6E - $0FFF
rbss_0    | Bank 0 RAM variables         | $0020 - $0063
intsave   | Registers saved on interrupt | $0064 - $0065
temp      | Temporary RAM data           | $0070 - $0071
intsave_0 | Registers saved on interrupt | $0072 - $0072
eeprom_da | User-programmed EEPROM data  | $2100 - $2117
config    | User-programmed CONFIG bits  | $2007 - $2007

Memory Usage Map:

Program ROM   $0004 - $0058  $0055 (    85) words
Program ROM   $01E8 - $07FF  $0618 (  1560) words
Program ROM   $0D6E - $0FFF  $0292 (   658) words
                             $08FF (  2303) words total Program ROM


I have 2303 total words, which is only about 60% of the total program memory. However, the compiler is not using any of the program memory from 0800 to 0D6E. That's over 1300 words unused, and it causes my program to run into the reserved space from 0F00-0FFF for bloader. Is there a reason the compiler avoids this area? Should I try putting bloader at 0800 instead of 0F00?
FlipFlops
 
Posts: 44
Joined: Mon May 09, 2005 4:26 pm

Postby cbatters » Tue May 10, 2005 7:27 am

FlipFlops wrote:Perhaps, but I'm not that skilled at this stuff yet. :D

Right now I'm running into a problem with PICC avoiding certain sections of the program memory space for no particular reason. My psect usage map and memory usage maps show:

Code: Select all
Psect Usage Map:

Psect     | Contents                     | Memory Range
----------|------------------------------|--------------------
powerup   | Power on reset code          | $0004 - $0007
intentry  | Interrupt service routine    | $0008 - $000E
intcode   | Interrupt service routine    | $000F - $0043
intret    | Interrupt service routine    | $0044 - $004A
init      | Initialization code          | $004B - $004E
end_init  | Initialization code          | $004F - $0051
clrtext   | Memory clearing code         | $0052 - $0058
text19    | Program and library code     | $01E8 - $04A8
text      | Program and library code     | $04A9 - $07FF
text10    | Program and library code     | $0D6E - $0FFF
rbss_0    | Bank 0 RAM variables         | $0020 - $0063
intsave   | Registers saved on interrupt | $0064 - $0065
temp      | Temporary RAM data           | $0070 - $0071
intsave_0 | Registers saved on interrupt | $0072 - $0072
eeprom_da | User-programmed EEPROM data  | $2100 - $2117
config    | User-programmed CONFIG bits  | $2007 - $2007

Memory Usage Map:

Program ROM   $0004 - $0058  $0055 (    85) words
Program ROM   $01E8 - $07FF  $0618 (  1560) words
Program ROM   $0D6E - $0FFF  $0292 (   658) words
                             $08FF (  2303) words total Program ROM


I have 2303 total words, which is only about 60% of the total program memory. However, the compiler is not using any of the program memory from 0800 to 0D6E. That's over 1300 words unused, and it causes my program to run into the reserved space from 0F00-0FFF for bloader. Is there a reason the compiler avoids this area? Should I try putting bloader at 0800 instead of 0F00?


Advise:

1. Compiler version
2. Compiler directives
3. Link options



Clint
cbatters
 
Posts: 65
Joined: Tue Jun 01, 2004 11:45 am

Postby FlipFlops » Tue May 10, 2005 7:51 am

16F87 (bloader recompiled using full version of cc5x)

HT PICC 8.05
Compiler options: -Zg9 -O -ASMLIST
Linker options: -psectmap -A0004h -RESROM0F00-0FFF

(having -A0004h or the -resrom statement makes no difference)

EDIT:
I found using the -ICD option will correctly reserve the last 256 words of memory. Although using -A0004h will allow bloader/screamer to load the file, it doesn't run correctly. I guess we will have to attempt modifications to bloader and screamer.
FlipFlops
 
Posts: 44
Joined: Mon May 09, 2005 4:26 pm

Postby cbatters » Thu May 12, 2005 9:18 am

FlipFlops wrote:16F87 (bloader recompiled using full version of cc5x)

HT PICC 8.05
Compiler options: -Zg9 -O -ASMLIST
Linker options: -psectmap -A0004h -RESROM0F00-0FFF

(having -A0004h or the -resrom statement makes no difference)

EDIT:
I found using the -ICD option will correctly reserve the last 256 words of memory. Although using -A0004h will allow bloader/screamer to load the file, it doesn't run correctly. I guess we will have to attempt modifications to bloader and screamer.


Not on my radar screen at the moment but it should not be that tough to make the necessary changes. A little surprised that Spark Fun doesn't see the incompatibility with HT PICC as an issue. Perhaps most of their users are using the CC5x cross compilers.

Wondering outloud if the right approach for HT is to use PSECT linker directives to reloacte the power up init code to after the interrupt vectors and stuff in a JMP to the powerup code at 0000.


Clint
cbatters
 
Posts: 65
Joined: Tue Jun 01, 2004 11:45 am

Postby FlipFlops » Thu May 12, 2005 9:21 am

The -A command moves the interrupt vector along with everything else. If you use -A4h then the interrupt vector is now at 8h instead of 4h. This is the psectmap:

Code: Select all
Psect     | Contents                     | Memory Range
----------|------------------------------|--------------------
powerup   | Power on reset code          | $0004 - $0007
intentry  | Interrupt service routine    | $0008 - $000E
intcode   | Interrupt service routine    | $000F - $0043
intret    | Interrupt service routine    | $0044 - $004A
init      | Initialization code          | $004B - $004E
end_init  | Initialization code          | $004F - $0051
clrtext   | Memory clearing code         | $0052 - $0058
text19    | Program and library code     | $01E8 - $04A8
text      | Program and library code     | $04A9 - $07FF
text10    | Program and library code     | $0C6E - $0EFF
rbss_0    | Bank 0 RAM variables         | $0020 - $0063
intsave   | Registers saved on interrupt | $0064 - $0065
temp      | Temporary RAM data           | $0071 - $0072
intsave_0 | Registers saved on interrupt | $0073 - $0073
eeprom_da | User-programmed EEPROM data  | $2100 - $2117
config    | User-programmed CONFIG bits  | $2007 - $2007
FlipFlops
 
Posts: 44
Joined: Mon May 09, 2005 4:26 pm

Postby cbatters » Thu May 12, 2005 9:48 am

Very familiar with the problem...as per your earlier post (and mine ;) )

Was simply floating a request to see if anyone knows another way to use -PSECT that DOES NOT change the lcoation of the interrupt vector.


Clint
cbatters
 
Posts: 65
Joined: Tue Jun 01, 2004 11:45 am

Postby FlipFlops » Thu May 12, 2005 9:52 am

Sorry, I was just clarifying what -A does, but I have a very strong feeling you know a whole lot more about this than me!
FlipFlops
 
Posts: 44
Joined: Mon May 09, 2005 4:26 pm

Postby sparky » Thu May 12, 2005 3:45 pm

Hey Clint,

(Throwing down the gauntlet) :twisted: Please, have a try at writing a *correct* bloader/screamer.

It was really painful writing Bloader/Screamer. Since that time, our coding time has been ridiculously reduced. No more waiting for the programmer to fail! Sorry I can't support more compilers/setups. It's a free program... But! I really appreciate users helping each other out. I don't have a clue about PICC. Sounds like you've got most of the solution. Let me know if you get an improved version of Bloader out there - I'd like to link to it for other PICC users.

-Nathan
User avatar
sparky
Site Admin
 
Posts: 1334
Joined: Mon May 05, 2003 6:02 pm
Location: Colorado

Postby cbatters » Fri May 13, 2005 5:03 am

sparky wrote:Hey Clint,

(Throwing down the gauntlet) :twisted: Please, have a try at writing a *correct* bloader/screamer.

It was really painful writing Bloader/Screamer. Since that time, our coding time has been ridiculously reduced. No more waiting for the programmer to fail! Sorry I can't support more compilers/setups. It's a free program... But! I really appreciate users helping each other out. I don't have a clue about PICC. Sounds like you've got most of the solution. Let me know if you get an improved version of Bloader out there - I'd like to link to it for other PICC users.

-Nathan


Taking up the gauntlet... :twisted: Happy to help... :D Just need to finish a 688 design and get some PCBs done (sending diles to you shortly for your PCB proto service) and then I'll lean on the 16F88 BLoader.

My only gripe has been that there is no disclaimer that the code bumping examples posted WILL NOT WORK on any PICC program that uses Interrupts as the "bumping" moves the interrupt vectors.


Clint
cbatters
 
Posts: 65
Joined: Tue Jun 01, 2004 11:45 am

Postby cbatters » Fri May 13, 2005 7:21 am

Hey FlipFlop....try this and let me know if it works for you.

Code: Select all

Update: Deleted code example that contained errors... see later post for correct info...





Note: Still need to figure out why using GOTO 0x08 instead of hard coding the op codes was giving me "phase errors"

#asm
psect reserved,class=CODE

goto 0x08 ; Gives phase error ????
dw 0 ; Keep it from stuffing init code into low mem
#endasm


Good luck,


Clint
Last edited by cbatters on Mon May 16, 2005 8:58 am, edited 1 time in total.
cbatters
 
Posts: 65
Joined: Tue Jun 01, 2004 11:45 am

Postby sparky » Fri May 13, 2005 12:20 pm

Excellent! Start another post and hassle me until I help out.

-Nathan
User avatar
sparky
Site Admin
 
Posts: 1334
Joined: Mon May 05, 2003 6:02 pm
Location: Colorado

Postby cbatters » Fri May 13, 2005 12:59 pm

sparky wrote:Excellent! Start another post and hassle me until I help out.

-Nathan


Premature to know if it really works but the memory maps / hex files sure look like it should work. (Don't have time right now to do any testing and I figured FlipFlop would be willing to give it a quick test...)

If this works, do you think we can get this added to the Bloader FAQ for HT PICC along with some of the useful comments you made in these posts?

AND - can we delete ALL references to #ORG 0x0004. I think 95% of the confusion is from examples / references to bumping code to 0x0004 and only one reference to the fact that you wouldn't want to do this if you were using interrupts. (and how many PIC programs aren't using interrupts??)

MUCH better to show bumping code to 0x0008 and showing interrupt vectors preserved at 0x0004


Clint
cbatters
 
Posts: 65
Joined: Tue Jun 01, 2004 11:45 am

Postby FlipFlops » Fri May 13, 2005 8:27 pm

Well, my interrupt service routine needs to go from 0004 to 000A, so I need to change to the -L-ppowerup=0Bh and the goto statement would be different. I also get the phase errors. Would it be dw 0x280B? Sorry, I'm pretty much a C programmer and that's it.

Unfortunately Screamer won't let you download the hex file because it doesn't have the correct statement at the beginning.

This is my psectmap after the changes:
Code: Select all
Psect     | Contents                     | Memory Range
----------|------------------------------|--------------------
reserved  | User defined psect           | $0000 - $0003
intret    | Interrupt service routine    | $0004 - $000A
powerup   | Power on reset code          | $000B - $000E
end_init  | Initialization code          | $019E - $01A0
init      | Initialization code          | $01A1 - $01A4
intentry  | Interrupt service routine    | $01A5 - $01AB
clrtext   | Memory clearing code         | $01AC - $01B2
intcode   | Interrupt service routine    | $01B3 - $01E7
text19    | Program and library code     | $01E8 - $04A8
text      | Program and library code     | $04A9 - $07FF
text10    | Program and library code     | $0C6E - $0EFF
rbss_0    | Bank 0 RAM variables         | $0020 - $0063
intsave   | Registers saved on interrupt | $0064 - $0065
temp      | Temporary RAM data           | $0071 - $0072
intsave_0 | Registers saved on interrupt | $0073 - $0073
eeprom_da | User-programmed EEPROM data  | $2100 - $2117
config    | User-programmed CONFIG bits  | $2007 - $2007
FlipFlops
 
Posts: 44
Joined: Mon May 09, 2005 4:26 pm

Postby cbatters » Mon May 16, 2005 5:55 am

FlipFlops wrote:Well, my interrupt service routine needs to go from 0004 to 000A, so I need to change to the -L-ppowerup=0Bh and the goto statement would be different. I also get the phase errors. Would it be dw 0x280B? Sorry, I'm pretty much a C programmer and that's it.

Unfortunately Screamer won't let you download the hex file because it doesn't have the correct statement at the beginning.



0x280B is near jump to 0x000B.

Are you using stock Bloader /Screamer or the one modified by Acrimu?



Clint
cbatters
 
Posts: 65
Joined: Tue Jun 01, 2004 11:45 am

PreviousNext

Return to Boot Loading

Who is online

Users browsing this forum: No registered users and 1 guest