Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flash.write safe area
01-04-2014, 10:52 PM, (This post was last modified: 02-04-2014, 01:58 PM by joel.)
#1
Flash.write safe area
Hi all,

justed wanted to know were it is safe to write some datas using flash.write function ?
Can it be deduced easily by looking into the .hex file to see were there is empty area?

[EDIT]

Let me put my question a different way, since this is not very clear when i read my question second time.
My progam is written for a pic 2550 and i am almost at 80% of the flash. What i want to know is if there is a way to identify area were we can write safely when looking at the lst and asm files or hex file. Also where is located the bootloader top of memory or bottom?)?
Or, is there a way to reserve some area in the flash, so that they can be dedicated to the flash.write operations (e.g a pragma command?)
Joël
Reply
04-04-2014, 01:28 PM,
#2
RE: Flash.write safe area
Hi Joel,
If you need a bit more of flash, try to use the bootloader v4.x instead of v2.x, you will get about 4KB more. This bootloader is located from 0x0000 to 0x0BFF. This is typically the kind of information you can get from the .lkr file. You can also modifiy this linker file (p8/lkr/boot4.18f25k50.lkr in your case) to protect a flash area such as your program can not be located at this place. However you can write/read/erase this area with the flash library (Flash.erase, Flash.read and Flash.write instructions).

For example, you could replace :
CODEPAGE NAME=apppage START=0x0C00 END=0x7FFF
by
CODEPAGE NAME=apppage START=0x0C00 END=0x6FFF
CODEPAGE NAME=mypage START=0x7000 END=0x7FFF PROTECTED
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
04-04-2014, 03:00 PM,
#3
RE: Flash.write safe area
Hi Regis

Merçi Beaucoup, c'est exactement ce que je cherchais!

Many thanks, that's exactly what i was searching for.

I already use the V4 bootloader...will probably switch to 26j50 or 27j53 if my code continue to grow...Sadly it will be difficult to use the 32mx250...missing 1 pin, but it would have be a lot nicer due to the way interrupt are handled...!

Joël


(04-04-2014, 01:28 PM)regis Wrote: Hi Joel,
If you need a bit more of flash, try to use the bootloader v4.x instead of v2.x, you will get about 4KB more. This bootloader is located from 0x0000 to 0x0BFF. This is typically the kind of information you can get from the .lkr file. You can also modifiy this linker file (p8/lkr/boot4.18f25k50.lkr in your case) to protect a flash area such as your program can not be located at this place. However you can write/read/erase this area with the flash library (Flash.erase, Flash.read and Flash.write instructions).

For example, you could replace :
CODEPAGE NAME=apppage START=0x0C00 END=0x7FFF
by
CODEPAGE NAME=apppage START=0x0C00 END=0x6FFF
CODEPAGE NAME=mypage START=0x7000 END=0x7FFF PROTECTED
Reply
04-04-2014, 03:42 PM, (This post was last modified: 04-04-2014, 03:43 PM by regis.)
#4
RE: Flash.write safe area
What are you doing with your 2550 ?

PS : I wrote p8/lkr/boot4.18f25k50.lkr but it is p8/lkr/boot4.18f2550.lkr
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
07-04-2014, 11:19 AM,
#5
RE: Flash.write safe area
A "motor controller board" for a telescope (as it was last year but no time to finish it) . the board interpret/decode commands sent by the PC (or a skywatcher controller) and then drive two stepper drivers (those tiny board from pollolu), either to track at sidereal rate or to do a fast goto/slew to a given location on the sky. Code is quite "large" due to the command decoding and some necessary calculation for tracking acceleration ramp, etc
In the same time i want to have pins for guiding (optical feedback to accuretaly track stars movement) which requires 4 pins (ST4 standard).
Total i need
- 2 pins for communication (serial, sadly CDC is not working with visual basic code for comm ports, at least on 2550 chip...an issue at port opening/handling for which i didn't find solution/help nor in this forum, nor in the VB ones, but which seems related to timing things on the microchip side, if my understanding of some discussion in microchip forums is correct )

- 4 pins for ST4
- 5 pins for each stepper driver, that is 10 pins total

hence a need for 16 I/O pins...which is 2 pins more than available on the 32MX250 board (or even 3, if i can not use the USERBUTTON one), except if i can "disable" USB things and use the 2 USB pins for my needs.. or if there is a solution for these CDC things....


Currently the code is working nicely with PC interface (tracking, goto,etc) but need some testing with stepper driver (i need to plug them to the board and onto a stepper motor) and then "in the field".

Joël

(04-04-2014, 03:42 PM)regis Wrote: What are you doing with your 2550 ?

PS : I wrote p8/lkr/boot4.18f25k50.lkr but it is p8/lkr/boot4.18f2550.lkr
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)