core: add an argument to thread_create() (implementation)#856
core: add an argument to thread_create() (implementation)#856Kijewski merged 2 commits intoRIOT-OS:masterfrom Kijewski:issue-847
thread_create() (implementation)#856Conversation
|
@Kijewski needs rebase |
examples/ccn-lite-client/main.c
Outdated
|
I like the idea, and the implementation seems to be strait forward. I want to use this functionality to start a helper thread with its private start parameter, different helper, different task @LudwigOrtmann @OlegHahm @kaspar030 what do you think? |
|
Yes, but please ignore my last commit |
|
Rebased and https://github.com/Kijewski/RIOT/commit/d3e58d7e5cf20885a8ec3c2467a3e449ab9bf23d un-picked. |
core/include/thread.h
Outdated
There was a problem hiding this comment.
what is the meaning of _ex ? extended?
There was a problem hiding this comment.
Yes, extended. The function is not meant to stick around for long, so I don't think that too much thoughts should be wasted on how to name it.
|
I added the argument passing to |
|
@rousselk, could you please test this branch on a real MSP device? Executing hello-world would be enough actually, because the thread entry already uses the function to execute as argument. |
|
@haukepetersen, @OlegHahm I cannot decipher the assembly in |
|
@haukepetersen, you said you were looking into that / providing me information after the meeting two weeks ago. (I am ARM assembler illiterate. :) ) |
|
Yes, true. The solution should be quite straight forwards, in /* r0 - r3 */
for (int i = 3; i >= 0; i--) {
stk--;
*stk = i;
}with /* r1 - r3 */
for (int i = 3; i >= 1; i--) {
stk--;
*stk = i;
}
/* r0 -> thread function parameter */
stk--;
stk = (uint32_t)arg; |
|
@haukepetersen, thanks! Rebased, and last boards added. Now we need to test it with every supported board.
|
|
I'll do next week for the Z1 and msb-430(h). |
|
@OlegHahm, please don't forget to check. ;) |
|
Can you rebase first? |
|
The rebase worked without any conflicts. I don't know why the button was grayed out. |
|
Now Travis is complaining. |
|
Fixed. |
|
Now I forgot to test... Try to think of it next week. |
|
@OlegHahm please don't forget to test. :) |
|
Tested for Z1, MSB-430(h) and redbee-econotag: everything's okay. Tested on IoT-Lab_M3: at least |
|
I modified https://github.com/RIOT-OS/thirdparty_cpu/blob/master/stm32f103rey6/cpu.c#L211 and the following following the cortex_m example to test with IoT-Lab_M3. |
|
I don't know ARM, I just did what @haukepetersen wrote. :-/ |
|
@haukepetersen, or @thomaseichinger maybe? Could you maybe look into the problem with IoT-Lab-M3? |
|
Yes, we can :-) I dont have a board here - will try to get one tomorrow. |
|
Just tested this with the arduino-due, at leas ipc_pingpong and test_vtimer_msg work just fine. |
|
Works with #PR1363 version for IoT-Lab_M3, too. I don't think we need to test it for the rest of the platforms: ACK |
|
@Kijewski PR needs rebase |
|
Rebased. |
|
Please second ACK anyone. 👀 |
|
AC |
|
I guess "AC" is good enough. :) |
core: add an argument to `thread_create()` (implementation)
|
K |
It's just a leftover from RIOT-OS#856
See discussion in #847. This PR adds a parameter to
thread_create()that is passed to the entry function.I implemented the additional argument for native and ARM boards. Tested with
test_thread_cooperationon native and msba2.I did not look into how to fix msp430-common's
thread_stack_init(), because I don't have a board to test with, anyway. I guess all you have to do is set the last "saved" register in cpu.c#L78 toarg.Right now this adds a new function instead of changing the current one. The sole reason for that is not to break the current tests. After we have confirmed that the change does work we can work on updating the tests and examples.
I would be happy to see PRs to my branch from kind people that want to help me fix the current examples and tests. -- That is if the discussion shows a consent on @kaspar030's suggestion to change the core function and don't use a legacy wrapper.