EmbeddedRelated.com
Forums

BL4S110 1M Memory. Dynamic C 10.50

Started by "mr.mattyg" June 28, 2010
Hi All,

I'm trying to understand the whole memory model for the BL4S110 that I'm using. The board data sheet says that I have 1M of available Serial Flash Memory (program). I loosely understand that this is comprised of Root Code, Root Data, Xmem Code, and Xmem Data.

What I don't understand is whether or not I truly have access to store a full 1M of code and data.

Also, if I do have the ability to store 1M of code and data am I limited to how much code and how much data I can use. So looking at the .org file that I'm creating at compile time do I only have ~422k of code (root + xmem) and ~608k of data (root + xmem0 + xmem1 + xmem2)? Is there any way to allocate these blocks differently to say have 800k code space and 200k data space?

It seems that using the ROOT_SIZE_4K macro def I only end up shifting how much root code and data I have, but don't actually gain more net code space (root & xmem).
Thanks in advance for any info, insight, or help you can provide me.

--- In r..., "mr.mattyg" wrote:
>
> Hi All,
>
> I'm trying to understand the whole memory model for the BL4S110 that I'm using. The board data sheet says that I have 1M of available Serial Flash Memory (program). I loosely understand that this is comprised of Root Code, Root Data, Xmem Code, and Xmem Data.
>
> What I don't understand is whether or not I truly have access to store a full 1M of code and data.
>
> Also, if I do have the ability to store 1M of code and data am I limited to how much code and how much data I can use. So looking at the .org file that I'm creating at compile time do I only have ~422k of code (root + xmem) and ~608k of data (root + xmem0 + xmem1 + xmem2)? Is there any way to allocate these blocks differently to say have 800k code space and 200k data space?
>
> It seems that using the ROOT_SIZE_4K macro def I only end up shifting how much root code and data I have, but don't actually gain more net code space (root & xmem).
> Thanks in advance for any info, insight, or help you can provide me.
>

The Rabbit cannot execute code out of serial flash. This board has a PIC that assists in booting the board so that the serial flash is
copied to RAM, which is 512K, not 1M. The rest of your flash is only useful as serial flash, not program, and I believe DC now supports using a FAT file system in it.

Code is copied to 512K of fast RAM. Data is in slow battery backed RAM. If code (including #ximports) exceeds 512K, you are out of code space. If data exceeds 512K, you are out of data. The two do not combine for 1M.

> The Rabbit cannot execute code out of serial flash. This board has a PIC that assists in booting the board so that the serial flash is
> copied to RAM, which is 512K, not 1M. The rest of your flash is only useful as serial flash, not program, and I believe DC now supports using a FAT file system in it.
>
> Code is copied to 512K of fast RAM. Data is in slow battery backed RAM. If code (including #ximports) exceeds 512K, you are out of code space. If data exceeds 512K, you are out of data. The two do not combine for 1M.
>
Hey Thanks Robert,

That makes 100% sense. So now I'm trying to use the FAT file system and place some of my large files that are currently in code space into unused flash data space. At first attempt using 'fat_create.c' Dynamic C is trying to tell me that my board doesn't support FAT.... I've included the bl4s1xx library and done brd_init() within main and also modified a line in 'fat_config.lib' to include BL4S100_SERIES to avoid creating a custom driver. Compiles now, but errors out when board tries to run.

Do you know if the BL4S110 should be able to use the FAT file system?

Thanks so much for your help,
Matt

> Hey Thanks Robert,
>
> That makes 100% sense. So now I'm trying to use the FAT file system
and place some of my large files that are currently in code space into
unused flash data space. At first attempt using 'fat_create.c' Dynamic
C is trying to tell me that my board doesn't support FAT.... I've
included the bl4s1xx library and done brd_init() within main and also
modified a line in 'fat_config.lib' to include BL4S100_SERIES to avoid
creating a custom driver. Compiles now, but errors out when board tries
to run.
>
> Do you know if the BL4S110 should be able to use the FAT file system?
>
> Thanks so much for your help,
> Matt
>

I don't have one of these boards to play with, but perusing the code, it
appears that FAT should support use of the serial flash on that board. I
suggest upgrading to DC 10.6x.
You might get better suggestions if you specify what error you are
seeing -- running out of xmem? Crash?
You might want to consider whether you really need the FAT. It adds a
fair amount of code and data overhead and complexity. You could use
lower level SF read write routines to access stuff in the serial flash
too.
http://mkembedded.com
--- In r..., "mr.mattyg" wrote:
>
> > The Rabbit cannot execute code out of serial flash. This board has a PIC that assists in booting the board so that the serial flash is
> > copied to RAM, which is 512K, not 1M. The rest of your flash is only useful as serial flash, not program, and I believe DC now supports using a FAT file system in it.
> >
> > Code is copied to 512K of fast RAM. Data is in slow battery backed RAM. If code (including #ximports) exceeds 512K, you are out of code space. If data exceeds 512K, you are out of data. The two do not combine for 1M.
> >
> Hey Thanks Robert,
>
> That makes 100% sense. So now I'm trying to use the FAT file system and place some of my large files that are currently in code space into unused flash data space. At first attempt using 'fat_create.c' Dynamic C is trying to tell me that my board doesn't support FAT.... I've included the bl4s1xx library and done brd_init() within main and also modified a line in 'fat_config.lib' to include BL4S100_SERIES to avoid creating a custom driver. Compiles now, but errors out when board tries to run.
>
> Do you know if the BL4S110 should be able to use the FAT file system?
>
> Thanks so much for your help,
> Matt
>

From the release notes in Dynamic C's installed path

...

VERSION 10.54

NEW FEATURES

...

- FAT filesystem now supported on unused portion of RCM4400W
serial data flash and serial boot flash of BL4S100-series boards.

It looks like you need at least version 10.54

Thanks Robert,

It appears that maybe a newer version of Dynamic C should make things more
Plug and Play rather than having to fool around with the FAT librarys....
The error I'm seeing after I compile fat_create.c or fat_shell.c to my board
is: 'While Debugging: Time out while waiting for response from Target'.

Not a very specific error....

I was a little worried about how much extra code space it would take to
include the FAT files... I basically have ~130 K of data that is mostly
website files that are currently getting compiled to code using #ximport.
Was thinking that if I move them to flash data space on the FAT file system,
the http server can still access them and I can free up ~130K data for more
code space. I'd imagine including the FAT library's won't take up more than
50 K data?????
Thanks again,
Matt
Robert and All,

Yeah BL4S100 Series boards have Serial Flash that is compatible to implement
the FAT file system. My problem was that the FAT library files weren't
working correctly for my board included in the Dynamic C Version 10.50.
I've upgraded to Dynamic C Version 10.64 and now I can use the FAT file
System on my board.
Thanks for all the help. Kind of a confusing world coming to this Rabbit
with only prior experience with Freescale and Renesas 16 and 32 bit
processors with ample space for code in data executed out of Flash.....

-Matt
On Jun 29, 2010, at 12:28 PM, Matt Gauthier wrote:
> The error I'm seeing after I compile fat_create.c or fat_shell.c to my board is: 'While Debugging: Time out while waiting for response from Target'.
>
> Not a very specific error....

Is that with your modified version of 10.50, or with a 10.54 or later release? I wouldn't be surprised if you got that message with 10.50 since it doesn't support FAT on the BL4S110.

All of the FAT samples in 10.54 and later should work on the BL4S110.

> I was a little worried about how much extra code space it would take to include the FAT files... I basically have ~130 K of data that is mostly website files that are currently getting compiled to code using #ximport. Was thinking that if I move them to flash data space on the FAT file system, the http server can still access them and I can free up ~130K data for more code space. I'd imagine including the FAT library's won't take up more than 50 K data?????

I don't think the FAT library will add more than 50K of code -- best thing to do is try it out.

-Tom
--- In r..., Tom Collins wrote:
>
> On Jun 29, 2010, at 12:28 PM, Matt Gauthier wrote:
> > The error I'm seeing after I compile fat_create.c or fat_shell.c to my board is: 'While Debugging: Time out while waiting for response from Target'.
> >
> > Not a very specific error....
>
> Is that with your modified version of 10.50, or with a 10.54 or later release? I wouldn't be surprised if you got that message with 10.50 since it doesn't support FAT on the BL4S110.
>
> All of the FAT samples in 10.54 and later should work on the BL4S110.
>
> > I was a little worried about how much extra code space it would take to include the FAT files... I basically have ~130 K of data that is mostly website files that are currently getting compiled to code using #ximport. Was thinking that if I move them to flash data space on the FAT file system, the http server can still access them and I can free up ~130K data for more code space. I'd imagine including the FAT library's won't take up more than 50 K data?????
>
> I don't think the FAT library will add more than 50K of code -- best thing to do is try it out.
>
> -Tom
>

Tom,
Originally none of the FAT sample programs worked since I was using 10.50. Now that I've upgraded to 10.62, all works great. Haven't looked at the exact size of the FAT library yet, but looks to not be tooo huge.

thanks,
matt