/*
 * bin_header_def.h
 *
 *  Created on: Jun 29, 2022
 *      Author: Invcuser52
 */

#ifndef BIN_HEADER_DEF_H_
#define BIN_HEADER_DEF_H_

#include <sys/_stdint.h>// <machine/_default_types.h>


#define CODE_SEC_EXE_STORED_LOC  0x01
#define CODE_SEC_EXE_INT_FLASH   0x02
#define CODE_SEC_EXE_EXT_FLASH   0x03

#define DATA_SEC_EXE_INT_RAM   0x01
#define DATA_SEC_EXE_EXT_SDRAM 0x02

#define LOADER_STATIC  0x55
#define LOADER_DYNAMIC 0xDD


#define STATIC_LOAD_ENABLE_CODE  0x0055
#define DYNAMIC_LOAD_ENABLE_CODE 0x00DD

#define STATIC_LOAD_ENABLE_DATA  0x0055
#define DYNAMIC_LOAD_ENABLE_DATA 0x00DD



/*
	Module_ID = 0x02
	Software version = 01.00
	Build date = 07-04-2022
	Code size = 0x23251234
	Data size = 0x93251234
	Bss size = 0x83251234
	Loader selection = 0x5a
	Destination load area for Code section = 0x01
	Destination load area for Data/Bss section = 0x04
	Static load address for Code = 0x80000000
	Static load address for Data/Bss = 0x20000000
*/

typedef struct binary_header_def
{
	uint32_t module_id;            // Software version
	uint32_t module_sw_version;    // Module_ID
	uint32_t build_date;           // build info
	uint32_t code_size;            // code size
	uint32_t data_size;            // data size
	uint16_t loader_selection_code;     // Loader selection
	uint16_t loader_selection_data;     // Loader selection
	uint32_t load_area_code;       // Destination load area for Code section
	uint32_t load_area_data;       // Destination load area for Data/Bss section
	uint32_t static_load_addr_code;     // Static load address for Code
	uint32_t static_load_addr_data;     // Static load address for Data/Bss
//	uint32_t reserved1;            // reserved - padding
//	uint32_t reserved2;            // reserved - padding
//	uint32_t reserved3;            // reserved - padding
//	uint32_t reserved4;            // reserved - padding
//	uint32_t reserved5;            // reserved - padding
//	uint32_t reserved6;            // reserved - padding

} s_binary_header_def;


#endif /* BIN_HEADER_DEF_H_ */
