This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: How can I use the flashs of sst29vfxxx and intel_strata at the same timeat redboot ???


On Wed, Sep 14, 2005 at 10:05:13AM +0800, Steven_cheng wrote:
> Hi Andrew,
> 
>     It does not works in some commands.
> 
> As following:
> RedBoot> fis list
> ... Read from 0x70fe0000-0x70fffbff to 0x0efe0000:
> Name              FLASH addr  Mem addr    Length      Entry point
> RedBoot           0x70000000  0x70000000  0x00040000  0x00000000
> FIS directory     0x70FE0000  0x70FE0000  0x0001FC00  0x00000000
> RedBoot config    0x70FFFC00  0x70FFFC00  0x00000400  0x00000000
> 
> RedBoot> load -m xmodem -b 0x100000
> CCCCAddress offset = 0x000c0000
> Entry point: 0x00100100, address range: 0x00100000-0x00135cc8
> xyzModem - CRC mode, 2553(SOH)/0(STX)/0(CAN) packets, 4 retries
> 
> RedBoot> fis create pX[RAM] -f 0xfff00000
> ... Read from 0x70fe0000-0x70fffbff to 0x0efe0000:
> ... Read from 0x70fe0000-0x70fffbff to 0x0efe0000:
> ... Read from 0x70fe0000-0x70fffbff to 0x0efe0000:
> Invalid FLASH address - not free!
> 
> I find it is taken mistake in find_free() (codebase is flashv2 branch of
> ecos);
> ////////////////////////////////////////////////////////////////////////////
> ///////////////////////////////////
> static int
> find_free(struct free_chunk *chunks)
> {
>     cyg_flashaddr_t err_addr;
>     cyg_flash_info_t info;
>     struct fis_image_desc *img;
>     int i=0, idx;
>     int num_chunks = 0;
>     int ret;
> 
>     do {
>       ret = cyg_flash_get_info(i, &info);
>       if (ret == CYG_FLASH_ERR_OK) {
>         if (i == 0 ) {
>           // Do not search the area reserved for pre-RedBoot systems:
>           chunks[num_chunks].start = (info.start +
>                                         CYGNUM_REDBOOT_FLASH_RESERVED_BASE +
>                                         CYGBLD_REDBOOT_MIN_IMAGE_SIZE);
>           chunks[num_chunks].end = info.end;
>           num_chunks++;
>         } else {   // Contiguous flash? If so collapse the chunks together.
>           if (chunks[num_chunks-1].end == (info.start -1)) {
>             chunks[num_chunks-1].end = info.end;
>           } else {
>             chunks[num_chunks].start = info.start;
>             chunks[num_chunks].end = info.end;
>             num_chunks++;
>           }
>         }
>       }
>       i++;
>     } while (ret != CYG_FLASH_ERR_INVALID);
> 
> /////////// chunks[] value  [correct !!]//////////////////////////////////
> chunks[0].start  = 0x70040000
> chunks[0].end = 0x70ffffff
> chunks[1].start  = 0xfff00000
> chunks[1].end = 0xfff7fffff

This looks OK.

> ///////////////////////////////////////////////////////////////////
> 
>     cyg_flash_read(fis_addr, fis_work_block, fisdir_size, &err_addr);
>     img = (struct fis_image_desc *) fis_work_block;
>     for (i = 0;  i < fisdir_size/sizeof(*img);  i++, img++) {
>         if (img->name[0] != (unsigned char)0xFF) {
>             // Figure out which chunk this is in and split it
>             for (idx = 0;  idx < num_chunks;  idx++) {
>                 if ((img->flash_base >= chunks[idx].start) &&
>                     (img->flash_base <= chunks[idx].end)) {
>                     if (img->flash_base == chunks[idx].start) {
>                         chunks[idx].start += img->size;
>                         if (chunks[idx].start >= chunks[idx].end) {
>                             // This free chunk has collapsed
>                             while (idx < (num_chunks-1)) {
>                                 chunks[idx] = chunks[idx+1];
>                                 idx++;
>                             }
>                             num_chunks--;
>                         }
>                     } else if ((img->flash_base+img->size) ==
> chunks[idx].end) {
>                         chunks[idx].end = img->flash_base;
>                     } else {
>                         // Split chunk into two parts
>                         chunks[idx+1].start = img->flash_base + img->size;
>                         chunks[idx+1].end = chunks[idx].end;
>                         if (++num_chunks ==
> CYGDAT_REDBOOT_FIS_MAX_FREE_CHUNKS) {
>                           diag_printf("Warning: too many free chunks\n");
>                           return num_chunks;
>                         }
>                         chunks[idx].end = img->flash_base;
>                     }
>                     break;
>                 }
>             }
>         }
>     }
>     return num_chunks;
> }
> #endif // CYGDAT_REDBOOT_FIS_MAX_FREE_CHUNKS
> 
> /////////// chunks[] value [Error value]//////////////////////////////////
> chunks[0].start  = 0x70040000
> chunks[0].end = 0x70fe0000
> chunks[1].start  = 0x71000000
> chunks[1].end = 0x70ffffff

And this is wrong. 

There was a patch to the trunk by Peter Korsgaard on 2005-06-29 which
fixed something here. It might be worth applying that patch to the v2
branch and see if it helps.

> ///////////////////////////////////////////////////////////////////
> 
> Question :
> 2. How can I get the lastest code for falsh multi-driver ??
> Use " cvs -z3 -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos co -r
> flashv2 -P ecos " ??

That looks OK.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]