build_host_tools() {
echo "Building host tools in $tools_dir"
-
+ # Debian packages tcl-dev and tk-dev are required for this build
local wd="$PWD"
local tcldirs="/usr/lib/tcl /usr/local/lib/tcl"
local config_opts=""
done
if [ -z "$config_opts" ];then
for d in /usr/lib/tcl*;do
+ [ -d "$d" ] || continue
config_opts="$config_opts --with-tcl-version=${d##*tcl}"
done
fi
#define MXC_UNLOCK_BLK_END 0xFFFF
extern unsigned int hal_timer_count(void);
-int nfc_program_region(flash_addr_t addr, u8 *buf, u32 len);
-int nfc_erase_region(flash_addr_t addr, u32 len, bool skip_bad, bool verbose);
+static int nfc_program_region(flash_addr_t addr, u8 *buf, u32 len);
+static int nfc_erase_region(flash_addr_t addr, u32 len, bool skip_bad, bool verbose);
static int nfc_write_pg_random(u32 pg_no, u32 pg_off, u8 *buf, u32 ecc_force);
static int nfc_read_pg_random(u32 pg_no, u32 pg_off, u32 ecc_force, u32 cs_line,
*
* @return FLASH_ERR_OK (0) if successful; non-zero otherwise
*/
-int nfc_erase_region(flash_addr_t addr, u32 len, bool skip_bad, bool verbose)
+static int nfc_erase_region(flash_addr_t addr, u32 len, bool skip_bad, bool verbose)
{
u32 sz, blk, update = 0, j = 0;
* @param len number of bytes
* @return FLASH_ERR_OK (0) if successful; non-zero otherwise
*/
-int nfc_program_region(flash_addr_t addr, u8 *buf, u32 len)
+static int nfc_program_region(flash_addr_t addr, u8 *buf, u32 len)
{
u32 sz, blk, update = 0, partial_block_size;
return FLASH_ERR_INVALID;
}
- partial_block_size = addr % NF_BLK_SZ;
+ partial_block_size = NF_BLK_SZ - (addr % NF_BLK_SZ);
mxc_nfc_buf_clear(NAND_SPAR_BUF0, 0xff, NF_SPARE_SZ);
addr = nfc_l_to_p(addr);
blk = OFFSET_TO_BLOCK(addr);
if (nfc_is_badblock(blk, g_bbt)) {
diag_printf("\nSkipping bad block %u at addr 0x%08llx\n", blk, addr);
+ g_block_offset++;
goto incr_address;
}
mark_blk_bad(blk, g_bbt, BLK_BAD_RUNTIME);
// we don't need to update the table immediately here since even
// with power loss now, we should see the same program error again.
+ g_block_offset++;
goto incr_address;
}
diag_printf(".");
incr_address:
addr += partial_block_size;
partial_block_size = NF_BLK_SZ;
- g_block_offset++;
}
if (update) {
if (program_bbt_to_flash() != 0) {
nfc_printf(NFC_DEBUG_MED, "%s: addr=0x%08llx, offset=%03x buf=0x%p, len=0x%08x\n",
__FUNCTION__, addr, offset, buf, len);
- addr = nfc_l_to_p(addr);
if (addr < (u32)flash_info.start || (addr + len) > (u32)flash_info.end || len == 0) {
diag_printf("** Error: flash address 0x%08llx..0x%08llx outside valid range %p..%p\n",
(u64)addr, (u64)addr + len - 1, flash_info.start, flash_info.end);
return FLASH_ERR_INVALID;
}
+ addr = nfc_l_to_p(addr);
while (len > 0) {
int i;
#define SREFR 3 /* 0: disabled 1-5: 2^n rows/clock *: rsrvd */
#define PWDT 1 /* 0: disabled 1: precharge pwdn
2: pwdn after 64 clocks 3: pwdn after 128 clocks */
-#define FP 0 /* 0: not full page 1: full page */
+#define FP 1 /* 0: not full page 1: full page */
#define BL 1 /* 0: 4(not for LPDDR) 1: 8 */
#define PRCT 0 /* 0: disabled *: clks / 2 (0..63) */
#define ESDCTLVAL (0x80000000 | (RA_BITS << 24) | (CA_BITS << 20) | \
#define tWR 0 /* clks - 2 (0..1) */ // 0
#define tRAS 5 /* clks - 1 (0..7) */ // 5
#define tRRD 1 /* clks - 1 (0..3) */ // 1
-#define tCAS 3 /* 0: 3 clks[LPDDR] 1: rsrvd *: clks (2..3) */ // 3
+#define tCAS 2 /* 0: 3 clks[LPDDR] 1: rsrvd *: clks (2..3) */ // 3
#define tRCD 2 /* clks - 1 (0..7) */ // 2
-#define tRC 8 /* 0: 20 *: clks - 1 (0..15) */ // 8
+#define tRC 7 /* 0: 20 *: clks - 1 (0..15) */ // 8
#define ESDCFGVAL ((tXP << 21) | (tWTR << 20) | (tRP << 18) | (tMRD << 16) | \
(tWR << 15) | (tRAS << 12) | (tRRD << 10) | (tCAS << 8) | \
parent CYGPKG_REDBOOT
include_dir ""
- cdl_option CYGBLD_BUILD_REDBOOT_WITH_WINCE_SUPPORT {
- display "Include MS Windows CE support"
- doc ref/wince.html
- default_value 1
- description "This option enables MS Windows CE EShell support
- and Windows CE .BIN images support"
+ cdl_option CYGBLD_BUILD_REDBOOT_WITH_WINCE_SUPPORT {
+ display "Include MS Windows CE support"
+ flavor bool
+ doc ref/wince.html
+ default_value 1
+ description "This option enables MS Windows CE EShell support
+ and Windows CE .BIN images support"
- compile -library=libextras.a wince.c
- }
+ compile -library=libextras.a wince.c
+ }
}
-
return;
}
if (prog_ok) {
+ FLASH_Enable((void *)flash_addr, (void *)(flash_addr + length));
// Erase area to be programmed
- if ((stat = flash_erase((void *)flash_addr, length, &err_addr)) != 0) {
+ stat = flash_erase((void *)flash_addr, length, &err_addr);
+ FLASH_Disable((void *)flash_addr, (void *)(flash_addr + length));
+ if (stat != 0) {
diag_printf("Can't erase region at %p: %s\n", err_addr, flash_errmsg(stat));
prog_ok = false;
}
// DRV_GLB 83B00000 00001000 RESERVED
//
- bin->eDrvGlb = CE_FIX_ADDRESS(header->ramEnd) -
- sizeof(ce_driver_globals);
+ bin->eDrvGlb = CE_FIX_ADDRESS(header->ramEnd);
return 1;
}
}
void setup_drv_globals(ce_driver_globals *drv_glb)
{
- diag_printf("%s %p\n", __FUNCTION__, drv_glb);
-
// Fill out driver globals
memset(drv_glb, 0, sizeof(ce_driver_globals));
#endif
}
-#if WINCE_ALTERNATE_ARG_BASE
-void setup_alt_drv_globals(ce_alt_driver_globals *alt_drv_glb)
+void setup_std_drv_globals(ce_std_driver_globals *std_drv_glb)
{
- diag_printf("%s %p\n", __FUNCTION__, alt_drv_glb);
// Fill out driver globals
- memset(alt_drv_glb, 0, sizeof(ce_alt_driver_globals));
+ memset(std_drv_glb, 0, sizeof(ce_std_driver_globals));
- alt_drv_glb->header.signature = ALT_DRV_GLB_SIGNATURE;
- alt_drv_glb->header.oalVersion = 1;
- alt_drv_glb->header.bspVersion = 1;
+ std_drv_glb->header.signature = STD_DRV_GLB_SIGNATURE;
+ std_drv_glb->header.oalVersion = 1;
+ std_drv_glb->header.bspVersion = 1;
- alt_drv_glb->kitl.flags = 0;
- diag_sprintf(alt_drv_glb->deviceId, "Triton");
+ std_drv_glb->kitl.flags = 0;
+ diag_sprintf(std_drv_glb->deviceId, "Triton");
#ifdef CYGPKG_REDBOOT_NETWORKING
- memcpy(&alt_drv_glb->kitl.mac[0], __local_enet_addr, sizeof(__local_enet_addr));
- diag_sprintf(alt_drv_glb->deviceId, "Triton%02X", __local_enet_addr[5]);
+ memcpy(&std_drv_glb->kitl.mac[0], __local_enet_addr, sizeof(__local_enet_addr));
+ diag_sprintf(std_drv_glb->deviceId, "Triton%02X", __local_enet_addr[5]);
// Local IP address
- memcpy(&alt_drv_glb->kitl.ipAddress, __local_ip_addr, sizeof(__local_ip_addr));
+ memcpy(&std_drv_glb->kitl.ipAddress, __local_ip_addr, sizeof(__local_ip_addr));
// Subnet mask
- memcpy(&alt_drv_glb->kitl.ipMask, __local_ip_mask, sizeof(__local_ip_mask));
+ memcpy(&std_drv_glb->kitl.ipMask, __local_ip_mask, sizeof(__local_ip_mask));
// Gateway config
#ifdef CYGSEM_REDBOOT_NETWORKING_USE_GATEWAY
// Getway IP address
- memcpy(&alt_drv_glb->kitl.ipRoute, __local_ip_gate, sizeof(__local_ip_gate));
+ memcpy(&std_drv_glb->kitl.ipRoute, __local_ip_gate, sizeof(__local_ip_gate));
#endif
#endif
}
-#else
-#define setup_alt_drv_globals(x) CYG_EMPTY_STATEMENT
-#endif
void ce_prepare_run_bin(ce_bin *bin)
{
ce_driver_globals *drv_glb;
-
- diag_printf("%s\n", __FUNCTION__);
-
-#if WINCE_ALTERNATE_ARG_BASE
- ce_alt_driver_globals *alt_drv_glb = &_KARO_CECFG_START;
+ ce_std_driver_globals *std_drv_glb = &_KARO_CECFG_START;
char *karo_magic = &_KARO_MAGIC[0];
unsigned long *karo_structure_size = &_KARO_STRUCT_SIZE;
memcpy(karo_magic, "KARO_CE6", sizeof(_KARO_MAGIC));
- *karo_structure_size = sizeof(ce_alt_driver_globals);
-#endif
+ *karo_structure_size = sizeof(ce_std_driver_globals);
+
// Clear os RAM area (if needed)
if (bin->edbgConfig.flags & EDBG_FL_CLEANBOOT) {
diag_printf("Preparing clean boot ... ");
drv_glb = (ce_driver_globals *)bin->eDrvGlb;
setup_drv_globals(drv_glb);
- setup_alt_drv_globals(alt_drv_glb);
+ setup_std_drv_globals(std_drv_glb);
// EDBG services config
memcpy(&drv_glb->edbgConfig, &bin->edbgConfig, sizeof(bin->edbgConfig));
#ifndef __WINCEINC_H__
#define __WINCEINC_H__
-#define WINCE_ALTERNATE_ARG_BASE 1
-
#pragma pack(1)
// Edbg BOOTME packet structures
// Used to pass driver globals info from RedBoot to WinCE core
#define DRV_GLB_SIGNATURE 0x424C4744 // "DGLB"
-#define ALT_DRV_GLB_SIGNATURE 0x53475241 // "ARGS"
+#define STD_DRV_GLB_SIGNATURE 0x53475241 // "ARGS"
typedef struct
{
OAL_ARGS_HEADER header;
char deviceId[16]; // Device identification
OAL_KITL_ARGS kitl;
-}
-ce_alt_driver_globals;
+} ce_std_driver_globals;
-externC ce_alt_driver_globals _KARO_CECFG_START;
+externC ce_std_driver_globals _KARO_CECFG_START;
externC char _KARO_MAGIC[8];
externC unsigned long _KARO_STRUCT_SIZE;
//}}}
//{{{ #include's
+#include <string.h>
#include "pkgconf/infra.h"
#include "cyg/infra/cyg_type.h"
// Without this symbol the header file has no effect
//{{{ #include's
// ----------------------------------------------------------------------------
+#include <string.h>
#include "cdlconfig.h"
// Get the infrastructure types, assertions, tracing and similar
//{{{ #include's
// ----------------------------------------------------------------------------
+#include <string.h>
#include "cdlconfig.h"
// Get the infrastructure types, assertions, tracing and similar
//{{{ #include's
// ----------------------------------------------------------------------------
+#include <string.h>
#include "cdlconfig.h"
// Get the infrastructure types, assertions, tracing and similar
#include <direct.h> /* for getcwd() */
#else
#include <unistd.h> /* for getcwd() */
+#include <limits.h> /* for PATH_MAX */
#endif
#ifdef __CYGWIN__
#include <windows.h>
//
//####DESCRIPTIONEND####
//==========================================================================
-
#ifndef _MSC_VER
#include <sys/param.h>
#include <unistd.h> /* for realpath() */
+#include <string.h>
#endif
#ifdef __CYGWIN__
#include <windows.h>