[libmaple] Latest – issues

Pito
Wed Jul 19, 2017 10:32 am
Finally I’ve downloaded the latest from Roger’s repo and now trying to compile the simple test http://www.stm32duino.com/viewtopic.php?f=51&t=2354 , for my Black F407 using the “Discovery F407 board spec”, working in Sloeber, vanilla repo..
Update: I have to use this in platform.txt for F4
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/
{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf"
"-L{build.path}" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common
-Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group {object_files} -Wl,--end-group

stevestrong
Wed Jul 19, 2017 11:27 am
Any specific example which does not work?
Please also attach the error messages.

The repo is designed for use with Arduino IDE, so your issues may be due to a Sloeber problematic…
Under PlatformIO I had no problems…


Pito
Wed Jul 19, 2017 12:44 pm
@steve: there is the link above with the simple example.
No error messages (provided I changed the chunk in the platform.txt, also see above). It compiles fine.
The older version of my libmaple repo works with Sloeber..

Pito
Wed Jul 19, 2017 1:21 pm
So this is the organization of my Arduino_STM32 folder which works with Sloeber here (with the newest libmaple as well):

Arduino_STM32 Org.JPG
Arduino_STM32 Org.JPG (17.27 KiB) Viewed 560 times

Pito
Wed Jul 19, 2017 3:36 pm
This is the recipe which works with latest RG libmaple under Sloeber (platform.txt):
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/
{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf"
"-L{build.path}" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common
-Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group {object_files} -Wl,--end-group

stevestrong
Wed Jul 19, 2017 4:07 pm
Pito,

having the latest version of Roger´s repo:
– I opened Arduino IDE, file->new
– selected “Generic STM32F407V series”, “USB serial (CDC)”
– pasted your example
– pressed the “Verify” button…
-> success.
No warnings, no errors.

– changing to “USB inactive”
– pressed the “Verify” button…
-> success.
No warnings, no errors.

So it doesn’t seem to be a Libmaple issue, since it works fine with Arduino IDE.

AS I told, your issue is probably linked with Sloeber.
Sorry, but there I cannot help you.

Closed from my side.

P.S. please also change the title.


Pito
Wed Jul 19, 2017 5:22 pm
AS I told, your issue is probably linked with Sloeber.
Sorry, but there I cannot help you.
Closed from my side.

@steve: I do not request you to do.. The fact the libmaple does not compile sources under Sloeber is indeed a kind of issue, as the Sloeber is an Eclipse plugin for arduino ide stuff.. There could be people who want to run Sloeber as the Sloeber is a bit more advanced as the arduino ide.. And there is not such code without bugs/issues, you know that well.. ;)

stevestrong
Wed Jul 19, 2017 5:43 pm
Pito, I don’t say that libmaple core is bug-free 8-)

I just want you to remove the reference of the issue to libmaple, because people seeing this may think that there is something wrong with libmaple core.
But it works under Arduino IDE, as it should.

In reality your issue is Eclipse+Sloeber plugin related.


Pito
Tue Aug 15, 2017 5:51 pm
Here is an indication the latest shows some anomaly with Heap/malloc().

http://www.stm32duino.com/viewtopic.php … =20#p32917

http://www.stm32duino.com/viewtopic.php … 924#p32924

When running the demo the latest crashes here, while Daniel’s works.

Maybe a third person may test. It is a quick test, ie with BluePill or Maple Mini.
Set n = 4000 for example.


RogerClark
Tue Aug 15, 2017 10:03 pm
This is a duplicate post thread and will be removed

Pito
Tue Aug 15, 2017 10:22 pm
Where is the duplicate please??

RogerClark
Tue Aug 15, 2017 10:50 pm
viewtopic.php?f=41&t=2434

“Libmaple problem, program crashes with call to malloc.”

You have linked to it yourself


stevestrong
Sat Aug 19, 2017 8:08 am
[RogerClark – Tue Aug 15, 2017 10:03 pm] –
This is a duplicate post thread and will be removed

OK from my side.


Pito
Sat Sep 02, 2017 10:07 am
While messing with map() function I see it returns wrong results with larger arguments.
It is because the multiplication in map() overflows.

This is a fix which works fine here (there is “long” in the original, I assume “long” == “int32_t”):

// Fix by Pito 9/2017
static inline int32_t map(int32_t value, int32_t fromStart, int32_t fromEnd,
int32_t toStart, int32_t toEnd) {
return ((int64_t)(value - fromStart) * (toEnd - toStart)) / (fromEnd - fromStart) +
toStart;
}


RogerClark
Sun Sep 03, 2017 1:03 am
Thanks

I’ve updated LibMaple F1 and F4 with your fix

(and attributed it to you)


victor_pv
Sun Sep 03, 2017 3:18 am
Pito new.cpp was missing from the libmaple F4. Both Roger and Steve have merged it. That should resolve the issues about malloc, or at least reduce the code size, since it will not pull new from stdlib.

On map(), looks like at least Teensy, and perhaps Arduino, have gone a bit further:
https://github.com/PaulStoffregen/cores … ring.h#L46

And I saw some conversation on allowing toend < tostart, not sure if that case is covered already?


Pito
Tue Sep 05, 2017 8:57 am
I’ve seen somewhere (not sure where) the guys did an overloaded map() which worked with all types (as well as with single/double float)..

Leave a Reply

Your email address will not be published. Required fields are marked *