From owner-p4-projects@FreeBSD.ORG Wed May 3 19:39:56 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7C2B816A406; Wed, 3 May 2006 19:39:56 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 12DE916A401 for ; Wed, 3 May 2006 19:39:56 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id A4BBA43DA0 for ; Wed, 3 May 2006 19:39:55 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k43JdsCV095708 for ; Wed, 3 May 2006 19:39:54 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k43Jds8q095702 for perforce@freebsd.org; Wed, 3 May 2006 19:39:54 GMT (envelope-from imp@freebsd.org) Date: Wed, 3 May 2006 19:39:54 GMT Message-Id: <200605031939.k43Jds8q095702@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 96610 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2006 19:39:57 -0000 http://perforce.freebsd.org/chv.cgi?CH=96610 Change 96610 by imp@imp_hammer on 2006/05/03 19:39:25 round the size to burn/compare to be a full flash page. Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/boot0spi/main.c#10 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/boot0spi/main.c#10 (text) ==== @@ -41,6 +41,9 @@ #define BURN_FPGA 1 +//#define OFFSET (15 * FLASH_PAGE_SIZE) +#define OFFSET 0 + int main(void) { @@ -52,18 +55,19 @@ #endif SPI_InitFlash(); + printf("Waiting for data\r\n"); while ((len = xmodem_rx(addr)) == -1) continue; #ifdef BURN_FPGA printf("\r\nDownloaded %u bytes.\r\n", len); - p_memcpy(addr3, addr, len); - printf("Writing %u bytes to flash\r\n", len); + p_memcpy(addr3, addr, (len + FLASH_PAGE_SIZE - 1) / FLASH_PAGE_SIZE * FLASH_PAGE_SIZE); + printf("Writing %u bytes to flash at %u\r\n", len, OFFSET); for (i = 0; i < len; i+= FLASH_PAGE_SIZE) { for (j = 0; j < 10; j++) { - off = i + 15 * FLASH_PAGE_SIZE; + off = i + OFFSET; SPI_WriteFlash(off, addr + i, FLASH_PAGE_SIZE); SPI_ReadFlash(off, addr2 + i, FLASH_PAGE_SIZE); - if (p_memcmp(addr3 + off, addr2 + off, FLASH_PAGE_SIZE) == 0) + if (p_memcmp(addr3 + i, addr2 + i, FLASH_PAGE_SIZE) == 0) break; } if (j >= 10)