• R/O
  • SSH
  • HTTPS

chibios: Commit


Commit MetaInfo

Revision15354 (tree)
Time2022-01-13 22:42:29
Authorgdisirio

Log Message

Extended SB header, all relocations working.

Change Summary

Incremental Difference

--- trunk/demos/STM32/RT-STM32L4R9-DISCOVERY-RAM_SB_HOST_DYNAMIC/main.c (revision 15353)
+++ trunk/demos/STM32/RT-STM32L4R9-DISCOVERY-RAM_SB_HOST_DYNAMIC/main.c (revision 15354)
@@ -299,8 +299,8 @@
299299
300300 /* Starting sandboxed thread 1.*/
301301 if (sbStartThread(&sbx1, "sbx1",
302- waUnprivileged1, sizeof (waUnprivileged1),
303- NORMALPRIO - 1) == NULL) {
302+ waUnprivileged1, sizeof (waUnprivileged1), NORMALPRIO - 1,
303+ 0, NULL, NULL) == NULL) {
304304 chSysHalt("sbx1 failed");
305305 }
306306 }
--- trunk/os/sb/host/sbelf.c (revision 15353)
+++ trunk/os/sb/host/sbelf.c (revision 15354)
@@ -37,32 +37,32 @@
3737 /*===========================================================================*/
3838
3939 /* Relevant ELF file types.*/
40-#define ET_EXEC 2U
40+#define ET_EXEC 2U
4141
4242 /* Relevant section types.*/
43-#define SHT_PROGBITS 1U
44-#define SHT_SYMTAB 2U
45-#define SHT_NOBITS 8U
46-#define SHT_REL 9U
43+#define SHT_PROGBITS 1U
44+#define SHT_SYMTAB 2U
45+#define SHT_NOBITS 8U
46+#define SHT_REL 9U
4747
4848 /* Relevant section flags.*/
49-#define SHF_WRITE (1U << 0)
50-#define SHF_ALLOC (1U << 1)
51-#define SHF_EXECINSTR (1U << 2)
52-#define SHF_INFO_LINK (1U << 6)
49+#define SHF_WRITE (1U << 0)
50+#define SHF_ALLOC (1U << 1)
51+#define SHF_EXECINSTR (1U << 2)
52+#define SHF_INFO_LINK (1U << 6)
5353
5454 /* Special section indices.*/
55-#define SHN_UNDEF 0U
55+#define SHN_UNDEF 0U
5656
5757 /* Supported relocation types.*/
58-#define R_ARM_ABS32 2U
59-#define R_ARM_THM_PC22 10U
60-#define R_ARM_THM_JUMP24 30U
61-#define R_ARM_MOVW_ABS_NC 43U
62-#define R_ARM_MOVT_ABS 44U
58+#define R_ARM_ABS32 2U
59+#define R_ARM_THM_PC22 10U
60+#define R_ARM_THM_JUMP24 30U
61+#define R_ARM_THM_MOVW_ABS_NC 47U
62+#define R_ARM_THM_MOVT_ABS 48U
6363
64-#define ELF32_R_SYM(v) ((v) >> 8)
65-#define ELF32_R_TYPE(v) ((v) & 0xFFU)
64+#define ELF32_R_SYM(v) ((v) >> 8)
65+#define ELF32_R_TYPE(v) ((v) & 0xFFU)
6666
6767 /*===========================================================================*/
6868 /* Module exported variables. */
@@ -280,8 +280,8 @@
280280
281281 return ((ins & 0x000000FFU) >> 0) |
282282 ((ins & 0x00007000U) >> 4) |
283- ((ins & 0x000F0000U) >> 5) |
284- ((ins & 0x04000000U) >> 11);
283+ ((ins & 0x000F0000U) >> 4) |
284+ ((ins & 0x04000000U) >> 14);
285285 }
286286
287287 static void set_const16(uint32_t address, uint32_t val16) {
@@ -289,8 +289,8 @@
289289 ((uint32_t)(((uint16_t *)address)[1]) << 0);
290290
291291 ins &= ~0x040F70FFU;
292- ins |= ((val16 & 0x00008000U) << 11) |
293- ((val16 & 0x00007800U) << 5) |
292+ ins |= ((val16 & 0x00000800U) << 14) |
293+ ((val16 & 0x0000F000U) << 4) |
294294 ((val16 & 0x00000700U) << 4) |
295295 ((val16 & 0x000000FFU) << 0);
296296
@@ -316,7 +316,7 @@
316316 case R_ARM_ABS32:
317317 *((uint32_t *)relocation_address) += (uint32_t)ctxp->map->base;
318318 break;
319- case R_ARM_MOVW_ABS_NC:
319+ case R_ARM_THM_MOVW_ABS_NC:
320320 /* Checking for consecutive "movw" relocations without a "movt", we
321321 consider this an error.*/
322322 if (ctxp->rel_movw_found) {
@@ -329,7 +329,7 @@
329329 ctxp->rel_movw_symbol = ELF32_R_SYM(rp->r_info);
330330 ctxp->rel_movw_address = relocation_address;
331331 break;
332- case R_ARM_MOVT_ABS:
332+ case R_ARM_THM_MOVT_ABS:
333333 /* Checking if we found a "movw" instruction before this "movt".*/
334334 if (!ctxp->rel_movw_found) {
335335 return CH_RET_ENOEXEC;
Show on old repository browser