Giter VIP home page Giter VIP logo

Comments (10)

jlbirccyn avatar jlbirccyn commented on May 25, 2024

Hello Sven. Could you post the OIL file and the tpl_app_config.c file ?

from trampoline.

grundmanns avatar grundmanns commented on May 25, 2024

Hello,
I added a cast to uint8_t and now it seems to be fixed. It this correct patch ? Is it a bug or a feature ?
if ((uint8_t)(READY_LIST(ready_list)[1].key) >

BR
Sven

from trampoline.

grundmanns avatar grundmanns commented on May 25, 2024

Hello Jean-Luc,
thank you very much for your lightning fast answer.
I will provide the files as requested by you.

One more comment:
The bubble up of the ready list seems to handle the negative key correctly.
Is the fact that the key gets negative the problem or is the handling of the negative key in the shown function the problem ?
What is the idea behind the fact that the priority key is a signed 8 bit integer and not a unsigned one ?
I even see in the code that there is an DOW_ASSERT right before the comparison, that is checking if the key is negative but it is cast it to uint32_t before, which mean it will always be positive and only in case the key is zero the ASSERT will fail. (The ASSERT is visible in the source window of my screenshot, but i guess it is disabled as i cannot see any assembly instructions that are representing the ASSERT)

One more addon:
The register values are and variables are all for real at the position.
It has compared r2 and r3 with the cmp r2,r3 instruction, which is FC and 1F, and the result is a N flag which means negative flag.
This will cause the next instruction, which is a ble to branch and avoid the preemption. It is treating the key FC as a negative number.

BR
Sven

from trampoline.

grundmanns avatar grundmanns commented on May 25, 2024

Hello Jean-Luc,
i put in the files.
debug.zip
I made a couple of tests. If I add top4 i get the problem, but if I use the same prio as the high tasks (prio 3) it is ok if I rebuild everything.
If I don't I also have the problem. I saw that the rank bit shift got changed from 5 bit to 4 bit with adding the additional task.
I guess the application was build with mixed setting and the rebuild was not proper.
BUT if I increase the prio of the top task from 3 to 4 and rebuild everything the problem is still there and I get the negative key.
BR
Sven Grundmann

from trampoline.

jlbirccyn avatar jlbirccyn commented on May 25, 2024

Hi Sven,

I checked the problem. First of all, the data type for tpl_priority had to be signed in the past but it appears that this restriction is no longer necessary. Moreover, if we consider a signed type, the number of bytes necessary to encode the priority is badly calculated in the templates. You have two options:

  1. change the type for priority in templates/code/tpl_app_custom_types_h.goilTemplate, line 58, rather than casting in the kernel code, to an unsigned.
  2. change the way the number of byte is computed. At line 1363 of root.goilTemplate you have:
let KEY_SIZE := [(1 << ([NUMBER_OF_PRIORITIES numberOfBits] +
                [MAX_JOBS_AMONG_PRIORITIES numberOfBits])) - 1 numberOfBytes]

It should be (but I did not test):

let KEY_SIZE := [(1 << ([NUMBER_OF_PRIORITIES numberOfBits] +
                [MAX_JOBS_AMONG_PRIORITIES numberOfBits] + 1)) - 1 numberOfBytes]

to take the sign bit into account.

Best regards

from trampoline.

grundmanns avatar grundmanns commented on May 25, 2024

Hello Jean-Luc,
thank you very much for the confirmation of the problem.

From my gut feeling I would fix it by using a unsigned 8 bit integer if the sign bit is not needed at all.
I think my trampoline version is m/o 2021 still.
I have also one software version of our software, that was upgraded to the latest git version of trampoline.

Do you know when the sign became obsolete ?
Was it already in my version from m/o 2021 or was it only recently ?

Will you also fix it in the github ?

BR
Sven Grundmann

from trampoline.

jlbirccyn avatar jlbirccyn commented on May 25, 2024

Hello Sven,

It became obsolete a long time ago. I would say around 2015.

I will fix it on GitHub.

Best regards

from trampoline.

grundmanns avatar grundmanns commented on May 25, 2024

Hello Jean-Luc,
I checked your comment and tried to fix the type from sint8 to uint8.
Unfortunately it is defined in custom app type header, which is autogenerated.
I tried to find the template, where it is generated, but I did't find it.
If you can point me to the file, I would prefer to fix the sint8 to uint8, instead of fixing the condition.

BR
Sven

from trampoline.

jlbirccyn avatar jlbirccyn commented on May 25, 2024

Hello Sven,

I commited the change yesterday: 61245ae

Best regards.

from trampoline.

grundmanns avatar grundmanns commented on May 25, 2024

Thank you. I will close the issue.

from trampoline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.