/*
 * incbin.h
 *
 *  Created on: 2023/06/09
 *      Author: BestTechnology
 */

#ifndef INCBIN_H_
#define INCBIN_H_

#define INCBIN(file, sym) __asm(\
   ".section .rodata\n"                  \
   ".balign 4\n"                         \
   ".global " #sym "\n"                  \
   #sym ":\n"                            \
   ".incbin \"" file "\"\n"              \
   ".global _size_" #sym "\n"            \
   ".set _size_" #sym ", . - " #sym "\n" \
   ".balign 4\n"                         \
   ".section \".text\"\n");              \
   extern const void *sym;\
   extern const size_t *_size_##sym;


#endif /* INCBIN_H_ */
