-
Notifications
You must be signed in to change notification settings - Fork 63
Is it possible to provide a way to easlily use customized modules? #775
Comments
Presently, I found many mbed developers forked the official modules in order to use their customized modules. For example, forked cmsis-core to use the customized module cmsis-core-xxxx. so I think they also have this kind of problem. Maybe yotta could provide a command line option, for example:
Then when yotta sees mymod module is referenced, it pull mymod from the specified URL instead of from yotta registry. |
You'd generally want to use yotta's config system to do this: http://yottadocs.mbed.com/reference/config.html It's up to the designers of a module to make it as customisable as it needs to be (e.g. provide an API, or configuration option that allows different handlers for output streams). You have to be careful though, as only the application can configure modules (modules cannot configure each other, as each module can exist in only one configuration in the system, but may have many modules depending on it): for modules which provide APIs that can have multiple instances these need to be configured dynamically. |
Maybe I didn't describe the problem clearly. Assuming that I build a simple blinky application by setting the target as stm32f429i-disco-gcc, the module tree is like this:
Assuming that I need to customize "mbed-hal-st-stm32cubef4" module to meet my needs, how could I direct yotta to import my version of "mbed-hal-st-stm32cubef4" module from a particular URL instead the one from yotta registry? |
In general, make a pull request against mbed-hal-st-stm32cubef4 to add the things you would like to be configurable to the config system. Otherwise, use |
@maxpeng Are you happy with this answer? |
I posted a question to mbed forum - Customized modules. I think it is better to re-post to here.
Original post:
"Write once and use everywhere" is the goal of component-based development. In my opinion, mbed OS utilizes modules to head towards that goal. However, sometimes I need to customize existing module(s) to meet my needs, but I could not find a feasible way to achieve that.
For example, the retarget.cpp of mbed-drivers implements the the low-level _write function to re-direct the debug messages to the serial port, but its speed is slow. On the contrary, Segger RTT could output debugging messages with very high performance. To use Segger RTT, I also need to re-implement the low level _write function. The end result is that I need a customized version of mbed-dirvers to disable the _write function in order to utilize Segger RTT.
To use the customized mbed-dirvers for my executable, I could use yotta link command to link to it. But how do I share the source of the executable to others to successfully build that executable? If they build the executable without using yotta link, yotta will pull mbed-drivers from the yotta registry.
How does mbed OS to solve this kind of problem? For example, the retarget.cpp of mbed-drivers implements the the low-level _write function to re-direct the debug messages to the serial port, but its speed is slow. On the contrary, Segger RTT could output debugging messages with very high performance. To use Segger RTT, I also need to re-implement the low level _write function. The end result is that I need a customized version of mbed-dirvers to disable the _write function in order to utilize Segger RTT.
To use the customized mbed-dirvers for my executable, I could use yotta link command to link to it. But how do I share the source of the executable to others to successfully build that executable? If they build the executable without using yotta link, yotta will pull mbed-drivers from the yotta registry.
How does mbed OS to solve this kind of problem?
The text was updated successfully, but these errors were encountered: