* @brief Get the length of an ELF file. * * @param filename Path to the ELF file. * @param file_len Pointer to store the file length. * @return RT_EOK on success, -RT_ERROR on failure. */
| 210 | * @return RT_EOK on success, -RT_ERROR on failure. |
| 211 | */ |
| 212 | static int elf_file_length(char *filename, rt_size_t *file_len) |
| 213 | { |
| 214 | int ret; |
| 215 | struct stat s = { 0 }; |
| 216 | |
| 217 | ret = stat(filename, &s); |
| 218 | if (ret != 0) |
| 219 | { |
| 220 | LOG_E("%s : error", __func__); |
| 221 | return -RT_ERROR; |
| 222 | } |
| 223 | *file_len = (rt_size_t)s.st_size; |
| 224 | |
| 225 | return RT_EOK; |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * @brief Read data from an ELF file at a specific offset. |