-
Notifications
You must be signed in to change notification settings - Fork 178
Added Mbed 2 to Mbed OS bare metal porting guide #1293
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
Conversation
Waiting for engineering review |
Looks good - thanks! |
34cf877
to
4730530
Compare
} | ||
``` | ||
|
||
- It might be necessary to reduce the stack size allocated for your target if it does not have enough RAM. The stack size is configured by setting a value for the `boot-stack-size` attribute; this value must be a multiple of 8 for alignment purposes. By default all targets are configured to have a boot stack size of 0x1000 (4096 bytes) in bare metal. However, this must be overridden if inadequate for your target. We recommend to reduce the boot stack size to 0x400 (1096 bytes) if your target has 8KB of RAM and to 0x300 (768 bytes) if your target has 4KB of RAM. |
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.
0x400 is 1024 bytes
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.
I'm not convinced, as far as I remember bare metal has only one stack. So the boot stack is the thread stack as well and the ISR stack.
0x400 (1096 bytes) if your target has 8KB of RAM
7K for global data and heap seems excessive. Also we'd like to have the applications pretty much portable if the stacks are different between different boards. The initial idea was that boards won't be allowed to play with stack sizes, only applications will be allowed to change them.
0x300 (768 bytes) if your target has 4KB of RAM.
Is it even possible to run Mbed on 4k board? Considering it's probably 8-16k flash...
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.
I'm not convinced, as far as I remember bare metal has only one stack. So the boot stack is the thread stack as well and the ISR stack.
0x400 (1096 bytes) if your target has 8KB of RAM
7K for global data and heap seems excessive. Also we'd like to have the applications pretty much portable if the stacks are different between different boards. The initial idea was that boards won't be allowed to play with stack sizes, only applications will be allowed to change them.0x300 (768 bytes) if your target has 4KB of RAM.
Is it even possible to run Mbed on 4k board? Considering it's probably 8-16k flash...
You are right that in bare metal the boot stack is the thread stack as well and the ISR stack. And that stack is defined to be 4K by default in https://github.com/ARMmbed/mbed-os/blob/master/targets/targets.json/#L60. For ultra constrained devices, it needs to be lowered.
LPC1114FN28: Flash 32kB, RAM 4kB was ported to bare metal ARMmbed/mbed-os@90d7e62; the recommendation to set boot-stack-size
to 0x300
comes from that port.
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.
OK, but this is an extreme example with target that small it doesn't make much sense to run Mbed and it makes even less sense for us to spend time on making it work. I'm afraid that this exceptions will lead to a mess when people see "oh you can do that as it's already done for this target". It would be more than reasonable to say that we require at least 32/48K of ROM and at 8K of RAM. How big is bare metal blinky these days?
} | ||
``` | ||
|
||
- It might be necessary to reduce the stack size allocated for your target if it does not have enough RAM. The stack size is configured by setting a value for the `boot-stack-size` attribute; this value must be a multiple of 8 for alignment purposes. By default all targets are configured to have a boot stack size of 0x1000 (4096 bytes) in bare metal. However, this must be overridden if inadequate for your target. We recommend to reduce the boot stack size to 0x400 (1096 bytes) if your target has 8KB of RAM and to 0x300 (768 bytes) if your target has 4KB of RAM. |
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.
I'm not convinced, as far as I remember bare metal has only one stack. So the boot stack is the thread stack as well and the ISR stack.
0x400 (1096 bytes) if your target has 8KB of RAM
7K for global data and heap seems excessive. Also we'd like to have the applications pretty much portable if the stacks are different between different boards. The initial idea was that boards won't be allowed to play with stack sizes, only applications will be allowed to change them.
0x300 (768 bytes) if your target has 4KB of RAM.
Is it even possible to run Mbed on 4k board? Considering it's probably 8-16k flash...
f3e7fc7
to
b17e581
Compare
I have addressed all review comments. Could you please re-review? |
f6aa714
to
180d538
Compare
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.
Looks good. My only concern is the stack size configuration, but we merge this as is and decide on stack 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.
I left some questions and suggestions.
Where it says "note to self" it's for me to do as a tidy-up before a merge.
6edc58a
to
250c462
Compare
I will take another look at it on the preview branch to make sure all formatting works
Waiting on 6-beta release to merge and publish. |
Code related PRs are all merged to master so you can merge this PR. |
* Added Mbed 2 to Mbed OS bare metal porting guide * Apply suggestions from code review * Tidying up I will take another look at it on the preview branch to make sure all formatting works * Wording fix Co-authored-by: Irit Arkin <[email protected]>
No description provided.