- added packhex

- flasjgen bugfix data types

git-svn-id: http://moon:8086/svn/mips@4 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2014-07-20 18:53:17 +00:00
parent 6f3d6c1b0c
commit 0d15861c80
4 changed files with 633 additions and 71 deletions
+13 -23
View File
@@ -2,17 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define INT8 char
#define INT16 short
#define INT32 long
#define UINT8 unsigned char
#define UINT16 unsigned short
#define UINT32 unsigned long
#define INT int
#define UINT unsigned int
#define FLOAT32 float
#define FLOAT64 double
#include <stdint.h>
#ifndef SDRAM_BASE
#define SDRAM_BASE 0x40000000
@@ -24,9 +14,9 @@
#define MAGIC_EB 0x4A464931 // "JFI1" in big-endian;
#define MAGIC_EL 0x3149464A // "JFI1" in little-endian;
UINT32 conv_endian32(UINT32 src)
uint32_t conv_endian32(uint32_t src)
{
UINT32 dst;
uint32_t dst;
dst = (0xFF000000 & (src << 24))
| (0x00FF0000 & (src << 8))
@@ -39,13 +29,13 @@ UINT32 conv_endian32(UINT32 src)
// --------------------------------------------------------------
typedef struct _sflash_img_hdr_t
{
UINT32 magic;
UINT32 target_addr;
UINT32 img_offset;
UINT32 img_size;
UINT32 hdr_next;
UINT8 img_name[128];
UINT8 res[108];
uint32_t magic;
uint32_t target_addr;
uint32_t img_offset;
uint32_t img_size;
uint32_t hdr_next;
uint8_t img_name[128];
uint8_t res[108];
} flash_img_hdr_t;
@@ -73,7 +63,7 @@ int main(int argc, char *argv[])
char name_flash[1024];
char name_prj[1024];
char *pBuf;
UINT32 *pBuf32;
uint32_t *pBuf32;
flash_img_hdr_t img_hdr = {0};
FILE *pFile;
@@ -107,7 +97,7 @@ int main(int argc, char *argv[])
filesize = (end-start);
pBuf = (char*)malloc(filesize);
fread(pBuf, 1, filesize, pFile);
filesize = fread(pBuf, 1, filesize, pFile);
fclose(pFile);
@@ -129,7 +119,7 @@ int main(int argc, char *argv[])
if ((argv[2][0] == '-') && (toupper(argv[2][1]) == 'E') && (toupper(argv[2][2]) == 'B'))
{
img_hdr.magic = MAGIC_EB;
pBuf32 = (UINT32*)pBuf;
pBuf32 = (uint32_t*)pBuf;
for (i=0; i < filesize/4; i ++)
pBuf32[i] = conv_endian32(pBuf32[i]);
}