From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29452 invoked by alias); 21 Aug 2004 07:54:24 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 29273 invoked from network); 21 Aug 2004 07:54:22 -0000 Received: from unknown (HELO londo.lunn.ch) (80.238.139.98) by sourceware.org with SMTP; 21 Aug 2004 07:54:22 -0000 Received: from lunn by londo.lunn.ch with local (Exim 3.36 #1 (Debian)) id 1ByQhp-0004G4-00; Sat, 21 Aug 2004 09:54:29 +0200 Date: Sat, 21 Aug 2004 07:54:00 -0000 To: Giri Raja Cc: ecos-discuss@ecos.sourceware.org Message-ID: <20040821075429.GF28592@lunn.ch> Mail-Followup-To: Giri Raja , ecos-discuss@ecos.sourceware.org References: <20040820234301.89469.qmail@web53804.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040820234301.89469.qmail@web53804.mail.yahoo.com> User-Agent: Mutt/1.5.6+20040803i From: Andrew Lunn Subject: Re: [ECOS] Problems in programming in FLASH - EB40A X-SW-Source: 2004-08/txt/msg00333.txt.bz2 On Fri, Aug 20, 2004 at 04:43:01PM -0700, Giri Raja wrote: > Hi, > I'm using a simple test program to program and read > from the FLASH memory in EB40A. I have a buffer that > contains all the data that is needed to store in the > FLASH. when I make the type of this buffer to be a chr > array, then I do not get any problems. however if I > define it to be of type cyg_uint8 or unsigned chr, > then I'm not sure if the data is written into the > FLASH properly. I check the validity of the > flash_program by doing a flash_read and printing out > the contents. > when the type was cyg_uint8 or unsigned chr, I see > only the first few bytes of the array written > properly, and then they keep repeating. The type of char should have no effect on the program to flash. > > here is the code that I'm using. > > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > > > > extern "C" { > void cyg_user_start(void); > } > > > > void cyg_user_start(void) > { > int err,i ; > unsigned char input_bytes[10]; > int length; > char *err_address ; > unsigned char readStr[10] ; > int p_base = 0x01030000; > > > > for(i = 0; i < 10; i++) > input_bytes[i] = (unsigned > char)(i+10); > > > > flash_init(diag_printf); > length = 10; > > > > for(i = 0; i < 10; i++) > diag_printf("the chrs - input_byes[%d] > = %u\n", i, input_bytes[i]); > What about eraseing before writing? > > err = flash_program((void *)&p_base, (void > *)input_bytes, length, (void **)&err_address); > > > > flash_read((void *)&p_base, (void *)readStr, > length, (void **)&err_address); > for(i = 0; i < length; i++) > diag_printf("byte[%d] = %u\n", i, > readStr[i]) ; > > > > Thank you very much. > > Giri. > > return ; > } > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > -- > Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos > and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss > -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss