mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-05-09 08:25:44 +02:00
[GH-ISSUE #399] cannot move location counter backwards #185
Labels
No labels
bug
duplicate
easy
enhancement
enhancement
fixed
fixed
good first issue
hard
invalid
pull-request
wontfix
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Upsilon#185
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @romain1235 on GitHub (Apr 13, 2026).
Original GitHub issue: https://github.com/UpsilonNumworks/Upsilon/issues/399
Sometimes, after modifying the upsilon code, I get an error when I compile:
cannot move location counter backwards (from 20038070 to 20038000). Every time I've had this error, I've shrunk the Python heap, but I was wondering why it appeared and if there was a way to resolve it without shrinking the Python heap.@Yaya-Cout commented on GitHub (Apr 13, 2026):
This error means the calculator doesn't have enough RAM. Everything is statically allocated (i.e. no
malloc/free), so there's no issue with the RAM being maxed outAs unused RAM is wasted RAM, almost everything is allocated. There are 3 big buffers you can adjust : Python heap (in
apps/code/app.hat line 78), RAM filesystem (ion/include/ion/internal_storage.hline 28) and Poincare pool (poincare/include/poincare/tree_pool.hline 54). Poincare is the math engine.If there's available memory (I think we have around 230 bytes left currently after the MicroPython upgrade), we increase the size off these buffers. If there's not enough memory, we can reduce their size (if the code can't be optimized to reduce memory usage).
@romain1235 commented on GitHub (May 2, 2026):
there is also the stack, no?
@Yaya-Cout commented on GitHub (May 2, 2026):
The stack is also manually allocated, at the end of the RAM: https://github.com/UpsilonNumworks/Upsilon/blob/upsilon-dev/ion/src/device/bootloader/bootloader_common.ld#L133
It's 32K when built as a slot (In flasher mode, it's different, so it's not specified in the main linkerscript): https://github.com/UpsilonNumworks/Upsilon/blob/upsilon-dev/ion/src/device/bootloader/bootloader.A.ld
The stack can cause issues when it overflows, because contrary to most operating systems on computer, we don't have any checks (I think there's a function to tell if the stack already overflowed, but it's almost never used). You can try to reduce it if you want to save memory, but this may cause issues with Poincare (the math engine) and some external apps. Reducing the stack size won't be accepted in Upsilon unless there's a strong reason to do so (due to the amount of potential issues).
When I tried to do an initial Numcraft port for Upsilon, one of my issues was the stack. On Epsilon, I think they have a bit more of unallocated memory, so stack overflows are less visible.