diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2024-10-24 19:49:33 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2024-11-13 14:25:59 -0500 |
commit | 9f328cab9536d73df697b325fab13dd7eb550522 (patch) | |
tree | d33548de4c6f585ac80b5d5dd3e28860ee404bf0 /lib/elf2uf2/elf.h | |
parent | c88ee84bed69f2903c7499b380043957b325e28b (diff) | |
download | kutter-9f328cab9536d73df697b325fab13dd7eb550522.tar.gz kutter-9f328cab9536d73df697b325fab13dd7eb550522.tar.xz kutter-9f328cab9536d73df697b325fab13dd7eb550522.zip |
lib: Move lib/rp2040/elf2uf2 to lib/elf2uf2
Recent versions of the rp2040 sdk no longer contain the elf2uf2 tool.
So, move that code to a new dedicated directory. This is in
preparation for updating the rp2040 sdk version.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'lib/elf2uf2/elf.h')
-rw-r--r-- | lib/elf2uf2/elf.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/elf2uf2/elf.h b/lib/elf2uf2/elf.h new file mode 100644 index 00000000..32e3dbb4 --- /dev/null +++ b/lib/elf2uf2/elf.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _ELF_H +#define _ELF_H + +#include <stdint.h> + +#define ELF_MAGIC 0x464c457fu + +#define EM_ARM 0x28u + +#define EF_ARM_ABI_FLOAT_HARD 0x00000400u + +#define PT_LOAD 0x00000001u + +#pragma pack(push, 1) +struct elf_header { + uint32_t magic; + uint8_t arch_class; + uint8_t endianness; + uint8_t version; + uint8_t abi; + uint8_t abi_version; + uint8_t _pad[7]; + uint16_t type; + uint16_t machine; + uint32_t version2; +}; + +struct elf32_header { + struct elf_header common; + uint32_t entry; + uint32_t ph_offset; + uint32_t sh_offset; + uint32_t flags; + uint16_t eh_size; + uint16_t ph_entry_size; + uint16_t ph_num; + uint16_t sh_entry_size; + uint16_t sh_num; + uint16_t sh_str_index; +}; + +struct elf32_ph_entry { + uint32_t type; + uint32_t offset; + uint32_t vaddr; + uint32_t paddr; + uint32_t filez; + uint32_t memsz; + uint32_t flags; + uint32_t align; +}; +#pragma pack(pop) + +#endif
\ No newline at end of file |