Flash Downloader

Aktualisiert nur ein mal die Applikation

nevoMV
 
Avatar
 
Subject:

Flash Downloader

 · 
Posted: 08.09.2015 - 15:13  ·  #1
Hallo Zusammen,

ich möchte für eine Applikation den E-LAB FlashDownloader nutzen.
Ich flashe hierzu die bootApp (abgeandelt von den Demos).
Im nächsten Schritt flashe ich mein Programm über den FlashDownloader.
Soweit so gut, die Applikation ist aufgespielt und ich bin glückliche...
Zumindest bis ich eine andere Version der Applikation aufspielen möchte.
Nach Hardwarereset kann ich über den FlashDownloader wieder flashen (er zeigt entsprechend den Fortschritsbalken eine angemessene Zeit an). Nur leider ist immer noch die erste Version drauf.
Neu laden des Projektes, Erase usw bringen nichts. Flashe ich den Bootloader wieder neu auf, siehe da, ich kann genau einmal wieder eine Applikation mit dem Flash Downloader Flashen.
Nun weiß ich irgendwie auch nicht weiter.

Anbei die BootApp und der relevante Teil aus der Applikation

Vielen Dank für die Hilfe!

Markus

Applikation
Code

Const
DownLoaderID : word   = $1234;           // mandatory constant


BootApp:
Code
(**********************************************)
(* Sample how to use a BootApp to program the *)
(* Main application via an UART               *)
(* This application is the bootloader and     *)
(* runs in the boot area                      *)
(**********************************************)

program XMega_BootAppSer;
{$NOSHADOW}
{ $WG}                     {global Warnings off}

Device = xmega128A3U, VCC=3.3;
{$BootApplication}                               // $20000

Define_Fuses
  Override_Fuses;
//  NoteBook  = A;
  COMport   = USB;
  ProgMode  = PDI;
  LockBits0 = [BLBB0, BLBB1, LB0, LB1];   // protect boot and app against read back
  FuseBits0 = [];
  FuseBits1 = [];
  FuseBits2 = [BootRst];                         // mandatory !!
  FuseBits5 = [BODACT0, BodLevel0, BodLevel1, BodLevel2];

Import SysTick, SerPortD1, FlashLoader, SysLEDblink, BeepPort;

From System Import Traps;

Define
 OSCtype = int2MHz, PLLmul=8;
//OSCtype = int32Mhz,
//          PLLmul=4,
//                   prescB=1,                     // PeripherX4=32MHz
//                   prescC=1;
 // OSCtype = ext16MHz, PLLmul=8;

  //OSCtype =extXTAL=16000000, PLLmul=8, prescA=1, prescB=2, prescC=1;
  
  StackSize      = $0300, iData;
  FrameSize      = $0300, iData;

  SysTick        = 10;
  IDATA1         = $1ff0;

  SerPortD1      = 9600, parNone;              // Download device
  RxBufferD1     = 255, iData;
  TxBufferD1     = 255, iData;

  BeepPort       = PortR, 0;
  SysLEDblink    = mSec300;                      // 10..1000 msec
  SysLEDBlink0   = PortR, 1, high;

Implementation

{$IDATA}
{--------------------------------------------------------------}
{ Type Declarations }

{--------------------------------------------------------------}
{ Const Declarations }
const
  // this constant must be the same as in the Main app
  DownLoaderID : word   = $1234;           // mandatory constant

  cStr         : string = 'ABCD';

{--------------------------------------------------------------}
{ Var Declarations }
{$IDATA1}
var
  bo     : boolean;
  bb     : byte;

{$IDATA}
var
  st1    : string[16];

{--------------------------------------------------------------}
{ functions }
procedure FlashLoaderInit;                    // mandatory
begin
end;

function FlashLoaderRecv : byte;              // mandatory
begin
  return(SerInpD1);
end;

procedure FlashLoaderTransm(arg : byte);      // mandatory
begin
  SerOutD1(arg);
end;
                                              // mandatory
procedure FlashLoaderExit;
begin
  if Application_Valid then
    EEprom[EEpromEnd]:= $00;  // validate application for Boot usage
  endif;
  BeepChirpH(3);
  mDelay(1000);
  HardwareReset;              // restart with a jump into the Boot
end;

// These procedures/functions can be called from the main application
function BootFunction : boolean; Trap;
begin
  nop;    // do anything
  nop;
  nop;
  return(bo);
end;

procedure BootProc(x : byte); Trap;
begin
  bb:= x;
end;

{--------------------------------------------------------------}
{ Main Program }
{$IDATA}
begin
  // optional a port pin can be checked for a forced download
  // if Pin.x = false then ...
  //  ...
  if EEprom[EEpromEnd] = $00 then
    // if a Download failed or the app was never programmed then there is no $00
    // if the main app forces a download then the last byte in the EEprom must be $FF
    //
    Application_Startup;
  endif;

  EnableInts($87);
  SysLEDflashAllOn;
  BeepChirpL(2);

  loop
    FlashDownLoader;
    // Downloader does an exit to the main app if
    // a valid main has been downloaded
  endloop;
end XMega_BootAppSer.
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: Flash Downloader

 · 
Posted: 08.09.2015 - 21:10  ·  #2
Hallo Markus,

der allererste Download tut und weitere nicht mehr?
Hatte ich noch nie und alle unsere Prommer arbeiten genau so.
Ich erinnere mich aber dass jemand hier im Forum mal das
gleiche Problem hatte.

rolf
nevoMV
 
Avatar
 
Subject:

Re: Flash Downloader

 · 
Posted: 09.09.2015 - 08:18  ·  #3
Hallo Rolf,

ja, der 1. ist erfolgreich. Bei allen weiteren wird scheinbar ganz normal ddie Applikation übtertragen. Aber nach dem Ende ist die 1. Version nach wie vor auf dem Chip...
Ich forste gerade nochmal das Forum durch...
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   64   78 · Page-Gen-Time: 0.020359s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI