Reply by Charles Manning September 10, 20082008-09-10
I must agree with Kris, although I now only use built-from-scratch tools.

If you're a newbie (and I'm not being disrespectful - we all were once), then
ARM + gcc + xxx is a **huge** ramp up. Starting with a pre-built environment
starts you in the shallow end and makes the task a lot more manageable.

Once you get familiar with that then start playing around with more complex
setups.

ARM is not going away any time soon. It is worth the investment to get to know
ARM better if you're serious about the embedded industry.

IMHO.

-- Charles
On Thursday 11 September 2008 14:01:18 Microbit_P43000 wrote:
> > However, I also do't think it is a very easy job to go ahead and use
>
> CrossStudio.
>
> I'd have to strongly disagree with that.
> CWARM is a real walk in the park to get going on existing ARM evals,
> turnkey.
> Just flash in one of the many provided example solutions and you're good to
> go.
> If you have problems with that, it would have to be an external factor
> you're introducing.
> In the beginning I used my own homebrew 'Wiggler' on Vero board and I never
> had any problems.
>
> The tools you're talking about are a pig to get going with, you're lost in
> the woods before you start....
>
> Then again, each to their own I guess :-)
>
> Best Regards,
> Kris
> ________________________________________
> From: A... [mailto:A...] On Behalf Of
> Maziar Tasbihi
> Sent: Monday, 8 September 2008 8:09 PM
> To: A...
> Subject: {Disarmed} Re: [AT91SAM] Re: AT91SAM7X256 internal flash read
> write with Rowley's CrossStudio
>
> Hello,
> I know what you are talking about when you say that the downloaded projects
> can only be run by GCC or IAR. However, I also do't think it is a very easy
> job to go ahead and use CrossStudio. I assume you mean to use the debug
> features? I have not exactly had complete success with debug on my home
> built JTAG. But I want to say this, that the best solution is the ECLIPSE
> and GCC solution, together with OPENOCD as the JTAG solution. I know it
> sounds crazy because most of these tools are real problem to work with, but
> I am saying if you are putting in so much effort, put it into that, since
> it can be tested by everyone.
> Thank you and to success.

Reply by Microbit_P43000 September 10, 20082008-09-10
> However, I also do't think it is a very easy job to go ahead and use
CrossStudio.

I'd have to strongly disagree with that.
CWARM is a real walk in the park to get going on existing ARM evals,
turnkey.
Just flash in one of the many provided example solutions and you're good to
go.
If you have problems with that, it would have to be an external factor
you're introducing.
In the beginning I used my own homebrew 'Wiggler' on Vero board and I never
had any problems.

The tools you're talking about are a pig to get going with, you're lost in
the woods before you start....

Then again, each to their own I guess :-)

Best Regards,
Kris
________________________________________
From: A... [mailto:A...] On Behalf Of
Maziar Tasbihi
Sent: Monday, 8 September 2008 8:09 PM
To: A...
Subject: {Disarmed} Re: [AT91SAM] Re: AT91SAM7X256 internal flash read write
with Rowley's CrossStudio

Hello,
I know what you are talking about when you say that the downloaded projects
can only be run by GCC or IAR. However, I also do't think it is a very easy
job to go ahead and use CrossStudio. I assume you mean to use the debug
features? I have not exactly had complete success with debug on my home
built JTAG. But I want to say this, that the best solution is the ECLIPSE
and GCC solution, together with OPENOCD as the JTAG solution. I know it
sounds crazy because most of these tools are real problem to work with, but
I am saying if you are putting in so much effort, put it into that, since it
can be tested by everyone.
Thank you and to success.

Reply by ckchan_4 September 10, 20082008-09-10
Thanks a lot Maziar !

--- In A..., Maziar Tasbihi wrote:
>
> Hi there, about the problem that you say it becomes necessary to
reset the board; it is true that I also have experienced this. I am
sorry that I cannot at the moment provide better answer in terms of
code sequence to use to test this, but I know this that it is
necessary to perform reset after you have loaded flash with the new
program, and the reset controller handles this, both via hardware or
software.
> So, I believe what has to be looked at, is what do the program
samples which ATMEL provide have in common which donot require the
reset performed manually, to look at linker script for example, etc.
Thank you and regards.
Foltos,
i'm executing the codes from Flash.. i tried to put "WriteNvmFlash"
routine in RAM section but it's the same.

I havent tried mapping the libmem to RAM though.. need to go through
documentation how to do it :p any pointer or hints ? ;)

thanks Foltos !
--- In A..., Foltos wrote:
>
> Hi,
>
> are you executing FLASH erase/write operations from RAM? Check your map
> file to see if libmem functions are mapped to
> RAM.
>
> Foltos
Reply by Maziar Tasbihi September 9, 20082008-09-09
Hi there, about the problem that you say it becomes necessary to reset the board; it is true that I also have experienced this. I am sorry that I cannot at the moment provide better answer in terms of code sequence to use to test this, but I know this that it is necessary to perform reset after you have loaded flash with the new program, and the reset controller handles this, both via hardware or software.
So, I believe what has to be looked at, is what do the program samples which ATMEL provide have in common which donot require the reset performed manually, to look at linker script for example, etc. Thank you and regards.

----- Original Message ----
From: ckchan_4
To: A...
Sent: Tuesday, September 9, 2008 7:46:56 AM
Subject: [AT91SAM] Re: AT91SAM7X256 internal flash read write with Rowley's CrossStudio - solved ?
hi Maziar,

i actually wanted to use internal flash as NVM storage for some
setting parameters. but i did have problem with connecting the JTAG
(JLink connected but when start debug, it says "cannot stop CPU") :)
but that is another problem (and another thread) to worry about..

anyway, here is the latest update.. i manage to write into the flash !

void TestFlashOK( void )
{
/* Register FLASH driver */
res = libat91sam7_ register_ libmem_driver( &flash_handle, 48000000);

// read initial data
res = libmem_read( buffer, nvm_dest , 256);
// update data
buffer[0] = buffer[0] + 1;

// Copy write_data to the destination memory area
res = libmem_write( nvm_dest, buffer, 256);

/* board will hang after executing the above !! */
/* reset the board to run, updated data is in flash */
}

but i have to reset the board as it will hang after flash writing.. is
this the way it suppose to work ?

--- In AT91SAM@yahoogroups .com, Maziar Tasbihi wrote:
>
> Hello,
> I know what you are talking about when you say that the downloaded
projects can only be run by GCC or IAR. However, I also do't think it
is a very easy job to go ahead and use CrossStudio. I assume you mean
to use the debug features? I have not exactly had complete success
with debug on my home built JTAG. But I want to say this, that the
best solution is the ECLIPSE and GCC solution, together with OPENOCD
as the JTAG solution. I know it sounds crazy because most of these
tools are real problem to work with, but I am saying if you are
putting in so much effort, put it into that, since it can be tested by
everyone.
> Thank you and to success.
Reply by Foltos September 9, 20082008-09-09
Hi,

are you executing FLASH erase/write operations from RAM? Check your map
file to see if libmem functions are mapped to
RAM.

Foltos

ckchan_4 wrote:
>
> hi Maziar,
>
> i actually wanted to use internal flash as NVM storage for some
> setting parameters. but i did have problem with connecting the JTAG
> (JLink connected but when start debug, it says "cannot stop CPU") :)
> but that is another problem (and another thread) to worry about..
>
> anyway, here is the latest update.. i manage to write into the flash !
>
> void TestFlashOK( void )
> {
> /* Register FLASH driver */
> res = libat91sam7_register_libmem_driver(&flash_handle, 48000000);
>
> // read initial data
> res = libmem_read(buffer, nvm_dest , 256);
> // update data
> buffer[0] = buffer[0] + 1;
>
> // Copy write_data to the destination memory area
> res = libmem_write(nvm_dest, buffer, 256);
>
> /* board will hang after executing the above !! */
> /* reset the board to run, updated data is in flash */
> }
>
> but i have to reset the board as it will hang after flash writing.. is
> this the way it suppose to work ?
>
> --- In A... ,
> Maziar Tasbihi wrote:
> >
> > Hello,
> > I know what you are talking about when you say that the downloaded
> projects can only be run by GCC or IAR. However, I also do't think it
> is a very easy job to go ahead and use CrossStudio. I assume you mean
> to use the debug features? I have not exactly had complete success
> with debug on my home built JTAG. But I want to say this, that the
> best solution is the ECLIPSE and GCC solution, together with OPENOCD
> as the JTAG solution. I know it sounds crazy because most of these
> tools are real problem to work with, but I am saying if you are
> putting in so much effort, put it into that, since it can be tested by
> everyone.
> > Thank you and to success.
>
>
Reply by ckchan_4 September 9, 20082008-09-09
hi Maziar,

i actually wanted to use internal flash as NVM storage for some
setting parameters. but i did have problem with connecting the JTAG
(JLink connected but when start debug, it says "cannot stop CPU") :)
but that is another problem (and another thread) to worry about..

anyway, here is the latest update.. i manage to write into the flash !

void TestFlashOK( void )
{
/* Register FLASH driver */
res = libat91sam7_register_libmem_driver(&flash_handle, 48000000);

// read initial data
res = libmem_read(buffer, nvm_dest , 256);
// update data
buffer[0] = buffer[0] + 1;

// Copy write_data to the destination memory area
res = libmem_write(nvm_dest, buffer, 256);

/* board will hang after executing the above !! */
/* reset the board to run, updated data is in flash */
}

but i have to reset the board as it will hang after flash writing.. is
this the way it suppose to work ?

--- In A..., Maziar Tasbihi wrote:
>
> Hello,
> I know what you are talking about when you say that the downloaded
projects can only be run by GCC or IAR. However, I also do't think it
is a very easy job to go ahead and use CrossStudio. I assume you mean
to use the debug features? I have not exactly had complete success
with debug on my home built JTAG. But I want to say this, that the
best solution is the ECLIPSE and GCC solution, together with OPENOCD
as the JTAG solution. I know it sounds crazy because most of these
tools are real problem to work with, but I am saying if you are
putting in so much effort, put it into that, since it can be tested by
everyone.
> Thank you and to success.

Reply by Maziar Tasbihi September 8, 20082008-09-08
Hello,
I know what you are talking about when you say that the downloaded projects can only be run by GCC or IAR. However, I also do't think it is a very easy job to go ahead and use CrossStudio. I assume you mean to use the debug features? I have not exactly had complete success with debug on my home built JTAG. But I want to say this, that the best solution is the ECLIPSE and GCC solution, together with OPENOCD as the JTAG solution. I know it sounds crazy because most of these tools are real problem to work with, but I am saying if you are putting in so much effort, put it into that, since it can be tested by everyone.
Thank you and to success.

----- Original Message ----
From: ckchan_4
To: A...
Sent: Monday, September 8, 2008 12:13:38 PM
Subject: [AT91SAM] Re: AT91SAM7X256 internal flash read write with Rowley's CrossStudio
i've tried using libmem library, manage to link the lib and register
the driver.

however, when i tried to unlock the page, it returns -5 which is
LIBMEM_STATUS_ NO_DRIVER

what went wrong ? thanks

following is the codes i used, most of it is sample provided..

/*********** *** begin ************ *******/
void TestFlash( void )
{
libmem_driver_ handle_t flash_handle;
uint8_t buffer[64];
const uint8_t write_data[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
int res;

// last page of internal flash
uint8_t *nvm_dest = (uint8_t *)0x0013F00;

/* Register FLASH driver */
libat91sam7_ register_ libmem_driver( &flash_handle, 48000000);

/* read initial data */
res = libmem_read( buffer, nvm_dest , sizeof(buffer) );
if (res == LIBMEM_STATUS_ SUCCESS)
{
printf("d1 : (%d)\n", buffer[0]);
}

/* Unlock the destination memory area */
res = libmem_unlock( nvm_dest, sizeof(write_ data));
if (res != LIBMEM_STATUS_ SUCCESS)
{
printf("unlock: (%d)\n", res);
}

/* Erase the destination memory area */
res = libmem_erase( nvm_dest, sizeof(write_ data), 0, 0);
if (res != LIBMEM_STATUS_ SUCCESS)
{
printf("erase: (%d)\n", res);
}

/* Copy write_data to the destination memory area */
res = libmem_write( nvm_dest, write_data, sizeof(write_ data));
if (res != LIBMEM_STATUS_ SUCCESS)
{
printf("write: (%d)\n", res);
}

/* Complete any outstanding transactions and */
/* put FLASH memory back into read mode */
res = libmem_flush( );
if (res != LIBMEM_STATUS_ SUCCESS)
{
printf("flush: (%d)\n", res);
}

// read again to confirm
res = libmem_read( buffer, nvm_dest , sizeof(buffer) );
if (res == LIBMEM_STATUS_ SUCCESS)
{
printf("d2 : (%d)\n", buffer[0]);
}
}

/*********** *** end ************ *******/

--- In AT91SAM@yahoogroups .com, "ckchan_4" wrote:
>
> Thank you very much Paul.. shall try it out first thing coming monday :)
>
> --- In AT91SAM@yahoogroups .com, "Paul Curtis" wrote:
> >
> > Hi,
> >
> > To run in ram, put it in the .fast section.
> >
> > Note that there is already a libmem driver for the SAM7X (which the
> flash
> > loader uses) so you can, if you wish, register the flash driver with
> libmem.
> >
> > e.g. the loader uses this:
> >
> > /* Register FLASH driver */
> > libat91sam7_ register_ libmem_driver( &flash1_handle, 48000000);
> >
> > The first parameter is a handle, the second is the CPU frequency
> (48MHz, in
> > this case).
> >
> > Once done, you can just write to flash as you wish.
> >
> > Rgds,
> >
> > --
> > Paul Curtis, Rowley Associates Ltd http://www.rowley. co.uk
> > CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: AT91SAM@yahoogroups .com [mailto:AT91SAM@yahoogroups .com] On
> Behalf
> > Of
> > > ckchan_4
> > > Sent: 05 September 2008 10:59
> > > To: AT91SAM@yahoogroups .com
> > > Subject: [AT91SAM] AT91SAM7X256 internal flash read write with
> Rowley's
> > > CrossStudio
> > >
> > > Hi guys,
> > >
> > > Anybody have done the internal flash read & write from CrossStudio
> > > project ? I've downloaded Atmel's internal flash project, but those
> > > are for gcc and IAR compiler..
> > >
> > > i tried to port over to CrossStudio, but i'm stuck at setting the
> > > function to run in RAM
> > >
> > > for IAR, it's __ramfunc
> > >
> > > for gcc, it's __attribute_ _ ((section (".ramfunc") ))
> > >
> > > what is for CrossStudio ?
> > >
> > > Thanks for your time !
> > >
> > >
> > >
> > >
> > > ------------ --------- --------- ------
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
>
Reply by ckchan_4 September 8, 20082008-09-08
Paul,

do i need to unlock, erase, write, lock and flush in the sequence ?
if i do that, i only get to run up to "read1: (2)". registration
returns 1, "reg: (1)" which is ok.

it didnt get to print "unlock: .. and just hung there and i have to
power cycle it/reset the board

thanks for your time Paul

/***********************************************************/
void NewTestFlash( void )
{
libmem_driver_handle_t flash_handle;
uint8_t buffer[64];
int res;

// last page of internal flash
uint8_t *nvm_dest = (uint8_t *)0x0013FF00;

/* Register FLASH driver */
res = libat91sam7_register_libmem_driver(&flash_handle, 48000000);
printf("reg : (%d)\n", res);

///* read initial data
res = libmem_read(buffer, nvm_dest , 1);
printf("read1 : (%d)\n", buffer[0]);

buffer[0] = buffer[0] + 1;

//* Unlock the destination memory area
res = libmem_unlock(nvm_dest, 256);
printf("unlock:(%d)\n", res);

// * Erase the destination memory area
res = libmem_erase(nvm_dest, 256, 0, 0);
printf("erase:(%d)\n", res);

//* Copy write_data to the destination memory area
res = libmem_write(nvm_dest, buffer, 1);
printf("write:(%d)\n", res);

//* Complete any outstanding transactions and
//* put FLASH memory back into read mode
res = libmem_flush();
printf("flush:(%d)\n", res);

// read again to confirm
res = libmem_read(buffer, nvm_dest , 1);
printf("read2 : (%d)\n", buffer[0]);
}

Reply by ckchan_4 September 8, 20082008-09-08
what went wrong is this

// last page of internal flash
uint8_t *nvm_dest = (uint8_t *)0x0013F00; <-- wrong typo

uint8_t *nvm_dest = (uint8_t *)0x0013FF00; <-- correct address
--- In A..., "ckchan_4" wrote:
>
> i've tried using libmem library, manage to link the lib and register
> the driver.
>
> however, when i tried to unlock the page, it returns -5 which is
> LIBMEM_STATUS_NO_DRIVER
>
> what went wrong ? thanks
> following is the codes i used, most of it is sample provided..
>
> /************** begin *******************/
> void TestFlash( void )
> {
> libmem_driver_handle_t flash_handle;
> uint8_t buffer[64];
> const uint8_t write_data[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
> int res;
>
> // last page of internal flash
> uint8_t *nvm_dest = (uint8_t *)0x0013F00;
>

Reply by ckchan_4 September 8, 20082008-09-08
i've tried using libmem library, manage to link the lib and register
the driver.

however, when i tried to unlock the page, it returns -5 which is
LIBMEM_STATUS_NO_DRIVER

what went wrong ? thanks
following is the codes i used, most of it is sample provided..

/************** begin *******************/
void TestFlash( void )
{
libmem_driver_handle_t flash_handle;
uint8_t buffer[64];
const uint8_t write_data[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
int res;

// last page of internal flash
uint8_t *nvm_dest = (uint8_t *)0x0013F00;

/* Register FLASH driver */
libat91sam7_register_libmem_driver(&flash_handle, 48000000);

/* read initial data */
res = libmem_read(buffer, nvm_dest , sizeof(buffer));
if (res == LIBMEM_STATUS_SUCCESS)
{
printf("d1 : (%d)\n", buffer[0]);
}

/* Unlock the destination memory area */
res = libmem_unlock(nvm_dest, sizeof(write_data));
if (res != LIBMEM_STATUS_SUCCESS)
{
printf("unlock:(%d)\n", res);
}

/* Erase the destination memory area */
res = libmem_erase(nvm_dest, sizeof(write_data), 0, 0);
if (res != LIBMEM_STATUS_SUCCESS)
{
printf("erase:(%d)\n", res);
}

/* Copy write_data to the destination memory area */
res = libmem_write(nvm_dest, write_data, sizeof(write_data));
if (res != LIBMEM_STATUS_SUCCESS)
{
printf("write:(%d)\n", res);
}

/* Complete any outstanding transactions and */
/* put FLASH memory back into read mode */
res = libmem_flush();
if (res != LIBMEM_STATUS_SUCCESS)
{
printf("flush:(%d)\n", res);
}

// read again to confirm
res = libmem_read(buffer, nvm_dest , sizeof(buffer));
if (res == LIBMEM_STATUS_SUCCESS)
{
printf("d2 : (%d)\n", buffer[0]);
}
}

/************** end *******************/
--- In A..., "ckchan_4" wrote:
>
> Thank you very much Paul.. shall try it out first thing coming monday :)
>
> --- In A..., "Paul Curtis" wrote:
> >
> > Hi,
> >
> > To run in ram, put it in the .fast section.
> >
> > Note that there is already a libmem driver for the SAM7X (which the
> flash
> > loader uses) so you can, if you wish, register the flash driver with
> libmem.
> >
> > e.g. the loader uses this:
> >
> > /* Register FLASH driver */
> > libat91sam7_register_libmem_driver(&flash1_handle, 48000000);
> >
> > The first parameter is a handle, the second is the CPU frequency
> (48MHz, in
> > this case).
> >
> > Once done, you can just write to flash as you wish.
> >
> > Rgds,
> >
> > --
> > Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> > CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: A... [mailto:A...] On
> Behalf
> > Of
> > > ckchan_4
> > > Sent: 05 September 2008 10:59
> > > To: A...
> > > Subject: [AT91SAM] AT91SAM7X256 internal flash read write with
> Rowley's
> > > CrossStudio
> > >
> > > Hi guys,
> > >
> > > Anybody have done the internal flash read & write from CrossStudio
> > > project ? I've downloaded Atmel's internal flash project, but those
> > > are for gcc and IAR compiler..
> > >
> > > i tried to port over to CrossStudio, but i'm stuck at setting the
> > > function to run in RAM
> > >
> > > for IAR, it's __ramfunc
> > >
> > > for gcc, it's __attribute__ ((section (".ramfunc")))
> > >
> > > what is for CrossStudio ?
> > >
> > > Thanks for your time !
> > >
> > >
> > >
> > >
> > >
> > >
> > >