summaryrefslogtreecommitdiff
path: root/src/helper
diff options
context:
space:
mode:
authorntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-06-16 14:45:55 +0000
committerntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-06-16 14:45:55 +0000
commit4b97f3cbb9603c13f69f8d3b5371c12045593126 (patch)
treec08fe66aa95fc2aac51a1bdf34cf5f4882dfe65b /src/helper
parent3d026ce94393e5e53cccb5d5364f9d500d5b3733 (diff)
downloadopenocd+libswd-4b97f3cbb9603c13f69f8d3b5371c12045593126.tar.gz
openocd+libswd-4b97f3cbb9603c13f69f8d3b5371c12045593126.tar.bz2
openocd+libswd-4b97f3cbb9603c13f69f8d3b5371c12045593126.tar.xz
openocd+libswd-4b97f3cbb9603c13f69f8d3b5371c12045593126.zip
- added mingw elf patches from Vincent Palatin
- added str9x programming using flash controller tap (str9xpec), including option bytes and device lock/unlock - inttypes.h now used for long long printf style declarations git-svn-id: svn://svn.berlios.de/openocd/trunk@174 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/replacements.h49
-rw-r--r--src/helper/time_support.c1
2 files changed, 50 insertions, 0 deletions
diff --git a/src/helper/replacements.h b/src/helper/replacements.h
index 0b132d77..ca042d60 100644
--- a/src/helper/replacements.h
+++ b/src/helper/replacements.h
@@ -24,6 +24,8 @@
#include "config.h"
#endif
+#include "types.h"
+
/* include necessary headers for socket functionality */
#ifdef _WIN32
#include <winsock2.h>
@@ -152,4 +154,51 @@ static __inline void socket_nonblock(int fd)
#endif
}
+#ifndef HAVE_ELF_H
+
+typedef struct
+{
+ unsigned char e_ident[16]; /* Magic number and other info */
+ u16 e_type; /* Object file type */
+ u16 e_machine; /* Architecture */
+ u32 e_version; /* Object file version */
+ u32 e_entry; /* Entry point virtual address */
+ u32 e_phoff; /* Program header table file offset */
+ u32 e_shoff; /* Section header table file offset */
+ u32 e_flags; /* Processor-specific flags */
+ u16 e_ehsize; /* ELF header size in bytes */
+ u16 e_phentsize; /* Program header table entry size */
+ u16 e_phnum; /* Program header table entry count */
+ u16 e_shentsize; /* Section header table entry size */
+ u16 e_shnum; /* Section header table entry count */
+ u16 e_shstrndx; /* Section header string table index */
+} Elf32_Ehdr;
+
+#define ELFMAG "\177ELF"
+#define SELFMAG 4
+
+#define EI_CLASS 4 /* File class byte index */
+#define ELFCLASS32 1 /* 32-bit objects */
+#define ELFCLASS64 2 /* 64-bit objects */
+
+#define EI_DATA 5 /* Data encoding byte index */
+#define ELFDATA2LSB 1 /* 2's complement, little endian */
+#define ELFDATA2MSB 2 /* 2's complement, big endian */
+
+typedef struct
+{
+ u32 p_type; /* Segment type */
+ u32 p_offset; /* Segment file offset */
+ u32 p_vaddr; /* Segment virtual address */
+ u32 p_paddr; /* Segment physical address */
+ u32 p_filesz; /* Segment size in file */
+ u32 p_memsz; /* Segment size in memory */
+ u32 p_flags; /* Segment flags */
+ u32 p_align; /* Segment alignment */
+} Elf32_Phdr;
+
+#define PT_LOAD 1 /* Loadable program segment */
+
+#endif /* HAVE_ELF_H */
+
#endif /* REPLACEMENTS_H */
diff --git a/src/helper/time_support.c b/src/helper/time_support.c
index 9615817f..de48fce8 100644
--- a/src/helper/time_support.c
+++ b/src/helper/time_support.c
@@ -21,6 +21,7 @@
#include "config.h"
#endif
+#include "replacements.h"
#include "time_support.h"
#include "log.h"