-
Notifications
You must be signed in to change notification settings - Fork 31
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
STM32F4 support #218
Comments
Can the makefile for compiling and creationg the binaries in Modelica_DeviceDrivers/EmbeddedTargets/STM32F4/Examples/STM32F4_Discovery/Blink/Makefile remain on this location? |
I just looked a bit more into the code. You moved the third party code into If you have a look into the Conventionally, all non Modelica files in a Modelica library are kept below the Notice that you can easily reference files in the resources directory from the documentation by a construct similar to I maybe would rather create a directory named |
|
Yes, sounds good. |
Shall we add the STMCube32F4 HAL interface into the thirdparty directory? I see no conflict in the license: |
Well, the license seems okay. However, the zip file has almost 400MB and having a link to it in the documentation (as you currently have) seems to be a good way to handle it. It should not go into the thirdparty directory. |
Ok, then only work left is to update the "README" file in the thirdParty folder. Onother question: |
What would be nice, is having a block in which one can configure the external interrupt to use and use that interrupt to activate certain parts of the model. However, there is no direct mapping from Modelica elements to this behaviour, yet. It would be an interesting extension and I would like to see it prototyped in OMC. For now, I see no nice way how to handle this. It might be possible to sort of use the generated "fmi2DoStep" as a callback function for the ISR, but that would entail some manual C code modifications by the user. |
Some comments to the build process. I tried to build the example on my Ubuntu 14.04.5 LTS. It turned out that the cross-compiler packages for that release are not working correctly. This is related to https://stackoverflow.com/questions/26931979/gnu-arm-nano-specs-not-found in which I followed the last suggestion of installing the package gcc-arm-embedded which can be added by an PPA as described at http://yottadocs.mbed.com/#linux-cross-compile. After doing that, I could build the blink project. Today, I ordered the STM32F4 discovery board and I'm looking forward to testing things once the board is delivered. It would be good to note the Ubuntu version which is the basis for the documentation in the documentation. |
Sorry, I'm developing on debian jessy. It was a bit fast to assume ubuntu working in the same way. I will update the documentation for my part. Here I didn't got the problems mentioned. So I can only document developed and tested on debian jessy and problems/solutions/workarounds with ubuntu could be added by ubuntu tester. But for now I can add already mention the problems mentioned. |
Regarding Interrupt handling I thought for now to provide a c-template, implementing empty |
Anyway, many times Ubuntu and Debian packages work similarly and it is only some small things that differ. I can test from the Ubuntu side and can complement the documentation where needed. |
@it-cosmos @sjoelund I received the board and could get it working :-) This is what needs to be done for Ubuntu 14.04.5 LTS (probably this can be improved, but just for not forgetting it): sudo apt-get install git libusb-1.0.0-dev pkg-config autotools-dev
git clone https://github.com/texane/stlink.git It seems one needs to install stlink. I tried without it, but I never could connect to the board. Installation and configuration hints are given on the project site, compilation is described in https://github.com/texane/stlink/blob/master/doc/compiling.md and I did basically: cd stlink
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
make install
udevadm control --reload-rules
udevadm trigger Now one probably should set up an sudo st-util Check the number of the opened port (default for me: 4242). I needed to start st-util first before I could connect with gdb: sudo arm-none-eabi-gdb
# Now in the debugger console enter
target remote localhost:4242
monitor reset halt
file Blink_main.elf
load
monitor reset
continue |
I missed that part, I think I got it easy since I started experimenting with TrueStudio lite, where st-link could be easily selected for connection. But I already forgot what I've really done. Good, that it's working now. |
I implemented GPIO Read and Write. The example here doesn't work because the Read Block is just initialized to false. The intension is, that when the blue user button is pressed all user leds should blink. in BlinkGPIO.mo: BlinkGPIO_fmi2Component BlinkGPIO_component = { The problem is that fmi2BooleanVars is intitialised to false and never gets updated with the current value in time the Function.Digital.read is never called in the code. How to solve this? |
I think you need to sample the read. Impure/external calls should not be performed in a continuous-time equation. |
Manually inserting the line |
I think in some parts of the backend, it might detect that the function doesn't vary over time and only reads it once. Anyway, the Modelica specification has some restrictions on calling impure functions (that we do not check, but if you don't follow them you might get unexpected results). Perhaps adding the impure keyword (or annotation) to the read function also fixes this (it should be added almost everywhere as a compiler hint). |
Unfortunately sample doesn't work yet. With the modification of the equation; |
Right, just adding the impure keyword to the read function fixes the problem. Thanks. |
Whith the pull request #221 the GPIO configuration for the speed and pull is hard coded in |
I think there is a problem with the omc compiler. Please check https://github.com/it-cosmos/Modelica_DeviceDrivers/tree/STM32F4. extObj[5] and [6] is assigned, although only 5 range from 0 to 4 are initialized. Further: As clockconf is passed in the modelica code to synchronizeRealtime1, it is not reflected in the generated code. The corret generated code would be: |
PR #216 from @it-cosmos provided support for STM32F4 which I merged into an STM32F4-feature branch (ae66aef).
This ticket shall serve as a point for discussing this feature with the aim to finally merge the feature into the master branch (probably also interesting for @sjoelund who provided the AVR support in #170).
The text was updated successfully, but these errors were encountered: