Skip to content

Commit 157df2c

Browse files
facchinmsoburi
authored andcommitted
wip: c33
1 parent 2a77c9b commit 157df2c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cores/arduino/main.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include "Arduino.h"
8+
#include "zephyr/kernel.h"
89
#include <cstdint>
910
#ifdef CONFIG_LLEXT
1011
#include <zephyr/llext/symbol.h>
@@ -68,7 +69,7 @@ static void __libc_init_array (void)
6869
__init_array_start[i] ();
6970
}
7071

71-
extern "C" __attribute__((section(".entry_point"), used)) void entry_point(k_thread_stack_t* stack, size_t stack_size) {
72+
extern "C" __attribute__((section(".entry_point"), used)) void entry_point(struct k_heap* stack, size_t stack_size) {
7273
// copy .data in the right place
7374
// .bss should already be in the right place
7475
// call constructors
@@ -77,7 +78,15 @@ extern "C" __attribute__((section(".entry_point"), used)) void entry_point(k_thr
7778
extern uintptr_t _edata;
7879
extern uintptr_t _sbss;
7980
extern uintptr_t _ebss;
81+
extern uintptr_t __heap_start;
82+
extern uintptr_t __heap_end;
8083
//__asm volatile ("cpsie i");
84+
85+
const size_t alignment = 4096;
86+
printk("Heap end: %p\n", &__heap_end);
87+
printk("Heap start: %p\n", &__heap_start);
88+
// __heap_start = (__heap_start + (alignment - 1)) & ~(alignment - 1);
89+
8190
memcpy(&_sdata, &_sidata, &_edata - &_sdata);
8291
memset(&_sbss, 0, &_ebss - &_sbss);
8392
__libc_init_array();

0 commit comments

Comments
 (0)