]> git.karo-electronics.de Git - karo-tx-redboot.git/commitdiff
Starterkit 5 Release 1.5 Bugfix
authorlothar <lothar>
Wed, 19 Aug 2009 14:42:33 +0000 (14:42 +0000)
committerlothar <lothar>
Wed, 19 Aug 2009 14:42:33 +0000 (14:42 +0000)
13 files changed:
build.sh
packages/devs/flash/arm/mxc/v2_0/src/mxc_nfc.c
packages/hal/arm/mx25/karo/v1_0/include/hal_platform_setup.h
packages/redboot/v2_0/cdl/wince.cdl
packages/redboot/v2_0/src/flash.c
packages/redboot/v2_0/src/wince.c
packages/redboot/v2_0/src/winceinc.h
tools/src/infra/assert.cxx
tools/src/libcdl/build.cxx
tools/src/libcdl/cdlmisc.cxx
tools/src/libcdl/parse.cxx
tools/src/tools/configtool/standalone/common/cdl_exec.cxx
tools/src/tools/configtool/standalone/common/ecosconfig.cxx

index e258acc4f290e5163057ff5a93ca4ccfee230e66..7681c6c42bef15b6b9908f4f7338add7c450e5ae 100644 (file)
--- a/build.sh
+++ b/build.sh
@@ -20,7 +20,7 @@ error() {
 
 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=""
@@ -32,6 +32,7 @@ build_host_tools() {
     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
index 4bcf00603d792217f80dd424c790ca50366f86d6..82309b94f4943bc58baa2fe707015aa2a8a8649b 100644 (file)
@@ -118,8 +118,8 @@ CYG_MACRO_END
 #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,
@@ -1063,7 +1063,7 @@ static int nfc_program_blk(u32 ra, u8 *buf, u32 len)
  *
  * @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;
 
@@ -1122,7 +1122,7 @@ int nfc_erase_region(flash_addr_t addr, u32 len, bool skip_bad, bool verbose)
  * @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;
 
@@ -1138,7 +1138,7 @@ int nfc_program_region(flash_addr_t addr, u8 *buf, u32 len)
                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);
@@ -1151,6 +1151,7 @@ int nfc_program_region(flash_addr_t addr, u8 *buf, u32 len)
                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;
                }
 
@@ -1163,6 +1164,7 @@ int nfc_program_region(flash_addr_t addr, u8 *buf, u32 len)
                        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(".");
@@ -1175,7 +1177,6 @@ int nfc_program_region(flash_addr_t addr, u8 *buf, u32 len)
 incr_address:
                addr += partial_block_size;
                partial_block_size = NF_BLK_SZ;
-               g_block_offset++;
        }
        if (update) {
                if (program_bbt_to_flash() != 0) {
@@ -1205,13 +1206,13 @@ int nfc_read_region(flash_addr_t addr, u8 *buf, u32 len)
        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;
 
index fa389c1677eead5ba38fe69912e8f14cb115fa7e..2d687592f60a325cffdc6837a76349af55624906 100644 (file)
@@ -669,7 +669,7 @@ nfc_data_output:
 #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) |               \
@@ -683,9 +683,9 @@ nfc_data_output:
 #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) |      \
index 139d6c3abd0716db2042c1cb33f5bd0b6e724b3e..424888123f1ce68b1a3474450cd8f58ce6337fe8 100644 (file)
@@ -41,14 +41,14 @@ cdl_package CYGPKG_REDBOOT_WINCE_SUPPORT {
        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
+       }
 }
-
index ac2dcf1bc6d43986487333da6b02d52019730987..b3f0beaa4ab56514e3fbf6ff9ed61ec6deba6338 100644 (file)
@@ -1132,8 +1132,11 @@ fis_create(int argc, char *argv[])
                        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;
                        }
index 5d91d83e3e3c3da8965f618afb068204eaf1660e..d8324dd12f3f9d34412d7a68461639a9f0d0ec35 100755 (executable)
@@ -412,8 +412,7 @@ bool ce_lookup_ep_bin(ce_bin *bin)
                        // 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;
                }
        }
@@ -425,8 +424,6 @@ bool ce_lookup_ep_bin(ce_bin *bin)
 
 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));
 
@@ -454,55 +451,46 @@ void setup_drv_globals(ce_driver_globals *drv_glb)
 #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 ... ");
@@ -515,7 +503,7 @@ void ce_prepare_run_bin(ce_bin *bin)
                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));
index 187b1e33bc70adbd0f714d40fae5bdba43dd9daa..63d9c6752818217973b86ad971dc12be7f40dbe6 100755 (executable)
@@ -1,8 +1,6 @@
 #ifndef __WINCEINC_H__
 #define __WINCEINC_H__
 
-#define WINCE_ALTERNATE_ARG_BASE 1
-
 #pragma pack(1)
 
 // Edbg BOOTME packet structures
@@ -176,7 +174,7 @@ typedef struct
 // 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
 {
@@ -231,10 +229,9 @@ 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;
 
index 27922a53f0b48bbec14c67e670de0dd5f7fd2805..f9477a099f0550578b0ac551f4f39967cbf05783 100644 (file)
@@ -48,6 +48,7 @@
 //}}}
 //{{{  #include's                                       
 
+#include <string.h>
 #include "pkgconf/infra.h"
 #include "cyg/infra/cyg_type.h"
 // Without this symbol the header file has no effect
index b9636278574b0143c99b053848f62fb1eb116e51..7c642df5ec8bdef2fe0462e0abdb3211b2e5b49f 100644 (file)
@@ -46,6 +46,7 @@
 //{{{  #include's                       
 
 // ----------------------------------------------------------------------------
+#include <string.h>
 #include "cdlconfig.h"
 
 // Get the infrastructure types, assertions, tracing and similar
index 83666297da070b5fce8d3eec8d04f639493f156a..f6ecc281ea39c5866784b83bcb757e47f941f4d0 100644 (file)
@@ -46,6 +46,7 @@
 //{{{  #include's                                               
 
 // ----------------------------------------------------------------------------
+#include <string.h>
 #include "cdlconfig.h"
 
 // Get the infrastructure types, assertions, tracing and similar
index db9ed0895b77e0748a643ba499bca2510f53ca40..2bcceee0eab48ab750ea06b2f97198f7f14525e9 100644 (file)
@@ -47,6 +47,7 @@
 //{{{  #include's                               
 
 // ----------------------------------------------------------------------------
+#include <string.h>
 #include "cdlconfig.h"
 
 // Get the infrastructure types, assertions, tracing and similar
index 91569f91922eda4c89ad97637ff95089805fb935..bb00d2b24efd4a37bb7e2918dcf1eaa788d87019 100644 (file)
@@ -42,6 +42,7 @@
 #include <direct.h> /* for getcwd() */
 #else
 #include <unistd.h> /* for getcwd() */
+#include <limits.h> /* for PATH_MAX */
 #endif
 #ifdef __CYGWIN__
 #include <windows.h>
index e0e7478af2d8953ca7ce4dfe451c5e24bd934509..726c2b5e5d3659367b182b30c05fa70b7fa127bd 100644 (file)
 //
 //####DESCRIPTIONEND####
 //==========================================================================
-
 #ifndef _MSC_VER
 #include <sys/param.h>
 #include <unistd.h> /* for realpath() */
+#include <string.h>
 #endif
 #ifdef __CYGWIN__
 #include <windows.h>