Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is
mbed_main: User's code to be executed before main().
. Should not be defined in the targetsWhat problem is here? Why a target code needs kernel to be initialized ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #5995: our C030 board requires configuration of a voltage level in its battery charger chip if it is to work reliably. This battery charger chip is only configurable over I2C. The [standard ST] I2C drivers make calls to
wait_us()
, which is an RTOS function. So our target code needs to do this configuration call after the RTOS has been initialised and before entry tomain()
. Is there such a hook, other thanmbed_main()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there is not.
target code should use what it has, target code, in this case us ticker functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I guess it is a rule that target code should not use RTOS calls. Is that written down somewhere, just so that I can have the discussion with ST (whose code it is)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grepping around a little, there are calls to
wait_ms()
andwait_us()
all over the place in the target code so I don't see how it can be a rule that target code should not use RTOS calls. The other option would be to introduce a hook for target configuration to occur after the RTOS has been initialised, since I can see that being generally useful. I will raise a separate issue for this.