Searching \ for '[PIC] PIC32 running a program entirely from RAM' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'PIC32 running a program entirely from RAM'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] PIC32 running a program entirely from RAM'
2012\05\02@135151 by Mike snyder

picon face
Hi All,

I need to run a program on the PIC32 entirely from RAM. This way we
could reflash the bootloader app on the flash if needed by loading a
program directly into RAM via USB or Setrial port and then executing
that  rather than the program on flash.

The C32 compiler provides a ramfunc keyword to run specific functions
in RAM but I am not very clear on how one would run an entire program
from RAM. One thought I am planning on trying out is to modify the
linker file so all address are in RAM and see if that would work -
however I wanted to check with the collective wisdom of the piclist to
see if anyone has already done that or something similar?

Thanks
Mik

2012\05\03@104005 by kris duff

flavicon
face
Usually, you can update your bootloader and your firmware when they are both on flash.

I'm not sure if I understood well, but if you load your software in ram, what will happen if you lose power ?

Sorry, I can not help you to place the program on ram, I don't know how to do it, but I'm not sure it is a very "safe" idea.

Regards!

Kris



________________________________
From: Mike snyder <spam_OUTmsnyder19TakeThisOuTspamgmail.com>
To: Microcontroller discussion list - Public. <.....piclistKILLspamspam@spam@mit.edu> Sent: Wednesday, May 2, 2012 1:51:51 PM
Subject: [PIC] PIC32 running a program entirely from RAM
Hi All,

I need to run a program on the PIC32 entirely from RAM. This way we
could reflash the bootloader app on the flash if needed by loading a
program directly into RAM via USB or Setrial port and then executing
that  rather than the program on flash.

The C32 compiler provides a ramfunc keyword to run specific functions
in RAM but I am not very clear on how one would run an entire program
from RAM. One thought I am planning on trying out is to modify the
linker file so all address are in RAM and see if that would work -
however I wanted to check with the collective wisdom of the piclist to
see if anyone has already done that or something similar?

Thanks
Mik

2012\05\03@143942 by Isaac Marino Bavaresco

flavicon
face
What I do when I need to update the bootloader is to create a special
application that carries the new bootloader's code embedded in itself.
First the bootloader programs the updater and runs it. The first action
that the updater does is to replace the reset vector so the old
bootloader is deactivated.
Then the updater programs the new bootloader. If everything went well,
the application installs the new reset vector and erases the magic
number that tells the bootloader that there is a valid application and
resets the processor.


Isaac


Em 3/5/2012 11:40, kris duff escreveu:
{Quote hidden}

> Mike

2012\05\03@160837 by Mark Hanchey

flavicon
face
On 5/2/2012 1:51 PM, Mike snyder wrote:
> The C32 compiler provides a ramfunc keyword to run specific functions
> in RAM but I am not very clear on how one would run an entire program
> from RAM. One thought I am planning on trying out is to modify the
> linker file so all address are in RAM and see if that would work -
> however I wanted to check with the collective wisdom of the piclist to
> see if anyone has already done that or something similar?
>
> Thanks
> Mike

There is a program that someone has written to implement a form of BASIC on the pic32 and it runs programs in ram that are typed in by the user. You might look at the source for that and see how it was done.
http://www.pic32.byvac.com/pic32_intro.php

Mark Hanchey

2012\05\03@162525 by Harold Hallikainen

face
flavicon
face

> On 5/2/2012 1:51 PM, Mike snyder wrote:
>> The C32 compiler provides a ramfunc keyword to run specific functions
>> in RAM but I am not very clear on how one would run an entire program
>> from RAM. One thought I am planning on trying out is to modify the
>> linker file so all address are in RAM and see if that would work -
>> however I wanted to check with the collective wisdom of the piclist to
>> see if anyone has already done that or something similar?
>>
>> Thanks
>> Mike
>
> There is a program that someone has written to implement a form of BASIC
> on the pic32 and it runs programs in ram that are typed in by the user.
> You might look at the source for that and see how it was done.
> http://www.pic32.byvac.com/pic32_intro.php
>
> Mark Hanchey

I suspect tokenized Basic is stored in RAM while the interpreter remains
in flash. I think the original poster is looking at running the bootloader
in RAM so he can overwrite boot flash. This, to me, is dangerous, but I
guess it could be done. You could end up with a dead box with nothing in
flash.

What I've done on PIC32 bootloading is to have the application write the
new code to external SPI flash. When the entire new code has been written
to external flash, a call to a simple (ideally, error free) function in
boot flash copies the external flash back to the application area internal
flash. To allow for things to go wrong, I also keep a copy of the factory
application code out in the external flash. Holding a certain button
combination on power up copies the factory code back to the application
flash so you can try again.

Harold





-- FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
Not sent from an iPhone

2012\05\03@164120 by Jan-Erik Soderholm

face picon face


Mark Hanchey wrote 2012-05-03 22:08:
> On 5/2/2012 1:51 PM, Mike snyder wrote:
>> The C32 compiler provides a ramfunc keyword to run specific functions
>> in RAM but I am not very clear on how one would run an entire program
>> from RAM. One thought I am planning on trying out is to modify the
>> linker file so all address are in RAM and see if that would work -
>> however I wanted to check with the collective wisdom of the piclist to
>> see if anyone has already done that or something similar?
>>
>> Thanks
>> Mike
>
> There is a program that someone has written to implement a form of BASIC
> on the pic32 and it runs programs in ram that are typed in by the user.

It (the "BASIC") probably *reads* "programs" from RAM and runs them in flash. The RAM only stores the BASIC statements, not the BASIC
interpreter as such.

To the PIC32, the BASIC statements in RAM is not "code", it is "data"

2012\05\03@182308 by Mark Hanchey

flavicon
face
On 5/3/2012 4:25 PM, Harold Hallikainen wrote:
> y
> I suspect tokenized Basic is stored in RAM while the interpreter remains
> in flash. I think the original poster is looking at running the bootloader
> in RAM so he can overwrite boot flash. This, to me, is dangerous, but I
> guess it could be done. You could end up with a dead box with nothing in
> flash.
>
>
> Harold
>

In quite a few of the Mips based processors in things like DVD players they are set up with two different loaders. The first is installed in non volatile ROM and loads the real boot loader. The first boot loader application doesn't have very many functions , just tftp options, or transferring the boot loader code from other sources.  This is a sample from such a player showing how it first loads the permanent CFE application that then loads BUPE the real bootloader application . Using CFE you can replace BUPE but CFE remains intact.

''
BCM74430010
Setting NAND Params
CFE starting from ROM
Starting code in RAM
Booting Secured uCFE...
BCM97601 B0-BSEC  uCfe v2.1.22 (CFE core v2.1, BSP_REV 22), Endian Mode: Little
Build Date: Mon Jan 25 15:37:45 EST 2010 (kdasu@stb-mhtb-04)
Copyright (C) Broadcom Corporation.
DDR                        : Bank0:128MB@400MHz | Bank1:256MB@400MHz
NAND Boot                  : FlashSize 512MB on CS0, BlkSize 128KB, PgSize 2048B
NAND vendor timing         : addc1095 HYNIX HY27UF084G2B SLC  t1(33535238) t2(80000b78)
BUPE     bootline< boot -elf flash0.cfe.0: >Loader:elf Filesys:raw Dev:flash0.cfe.0 File: Options:(null)
Loading: 0x87000000/22500 0x870057e4/127 0x87005880/2227 0x87007efc/596020 0x87099740/288 0x87099860/542800
Successfully loaded secure elf image....
Entry address is 0x87000000
Starting program at 0x87000000

""
It is very similar to what you suggest with the SPI flash.
Mark

More... (looser matching)
- Last day of these posts
- In 2012 , 2013 only
- Today
- New search...