Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making the ISPM work on all cores using the bootloader #154

Open
Emoun opened this issue Aug 14, 2024 · 7 comments
Open

Making the ISPM work on all cores using the bootloader #154

Emoun opened this issue Aug 14, 2024 · 7 comments

Comments

@Emoun
Copy link
Member

Emoun commented Aug 14, 2024

We currently have the issue of the instruction scratchpad (ISPM) not working on non-main cores.

It works on the main core by the bootloader reading the downloaded ELF and putting anything that is in the .text.spm section in the ISPM.
However, this does not work for other cores since there is no way for the main core to load stuff into other cores' ISPMs, and there is no way for the cores themselves to do it, since they are called using pthreads or coresthread_create.

My idea is to update corethread/pthreads such that they call the bootloader on the other cores instead of the given function. The bootloader will be updated such that if it is not called from the main core, it loads the ISPM then runs the required function. This of course requires an update to the bootloader.

This is not totally fleshed out, but I think it would be a good way to use existing functionality in the bootloader to give us access to the ISPMs on non-main cores.

@Emoun
Copy link
Member Author

Emoun commented Aug 14, 2024

An alternative is to add functionality to the bootloader that calls a bootloader-function on eacher non-main core, whose only job is to load the ISPM. The core then goes back to sleep.
This would mean all cores' ISPM are loaded from the beginning and corethread/pthreads does not need to know about the bootloader.

@schoeberl
Copy link
Member

Thanks for looking into this. Let us think about it when there is a need. This is very brittle anyway, as one needs to decide which functions shall be on which core. I do not think we want to have the very same function in all core's ISPMs.

@Emoun
Copy link
Member Author

Emoun commented Aug 14, 2024

I've just opened this issue to write down my ideas. No plan to actually do any of this yet.

I've also thought about what goes in each core's ISPM. We could also allow additional core-specific section, like .text.spm.0, .text.spm.1. This would give us a section for all cores (.text.spm) and individual sections, though how exactly to map this in memory is an open question.

@schoeberl
Copy link
Member

A maybe not so trivial issue is that all ISPMs are mapped to the same address. Can we have several functions in the .elf file that are mapper to the same address?

@Emoun
Copy link
Member Author

Emoun commented Aug 14, 2024

I think it is possible in ELF to have sections referencing the same addresses. Though I have no experience with this, so maybe this is a misunderstanding of mine. We'll need to explore and test more.

@torurstrom
Copy link
Contributor

I think there is some misunderstanding here. In the bootloader, which is the same for all cores, we have these lines

// initialize the content of the I-SPM from the main memory
  // copy words not bytes
  for (int i = 0; i < get_ispm_size()/4; ++i) {
    // starting at 64 K (1 << 16) word address (/4)
    *(SPM+(1<<16)/4+i) = *(MEM+(1<<16)/4+i);
  }

This is executed by all cores. Now, this might no longer work, for whatever reason, but the intention is that each core copies instructions from the main memory to the SPM.

@schoeberl
Copy link
Member

I think we never had a usable solution for using the I-SPM on all cores, just the first core. And even that we have never really used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants