cancel
Showing results for 
Search instead for 
Did you mean: 

STM32W and SimpleMAC Library

Martin.Sergio
Associate III
Posted on March 19, 2013 at 09:54

The original post was too long to process during our migration. Please click on the attachment to read the original post.
38 REPLIES 38
frankmeyer9
Associate II
Posted on March 25, 2013 at 10:54

I'm from Spain ;)

 

Sorry, slightly off ... my Spanish is not better.

But the languages are similiar, and allow for basic intermixed communication.

I'm sure it's easier to use a supported environment.

 

When using the IAR trial every was simpler, all examples run well, included examples with simplemac library, but i can not afford to pay a license.

 

I can understand those companies. Barely visible at first glance, the seamless integration of all the different MCU's is hard and tedious work. They are not willing to give everything away for free. With a free toolchain, you will have to do that work for yourself. They are only free if you don't value the extra time spend. A second, similiar problem will probably cause much less pain, once you know the way. But for another MCU, you can budget for the same effort and time spent.

Alternatively, you may consider a limited licence of a commercial toolchain. Keil is said to offer an affordable one with a 256k restriction, CodeRed too. Not heard such thing of IAR. And Rowley/Crossworks has an affordable private licence.

frankmeyer9
Associate II
Posted on March 25, 2013 at 11:41

I hope you realize that

wchar_t

is not a C datatype, but just a

typedef

'd reference. Any *_t datatype is system-dependant. And it is usually not defined inside you packet, but in a system header file of your toolchain.

So your wchar_t datatype might have a size issue, and possibly a signedness issue. When you don't have the source for your library, you will need change that typedef for your project.

Can't you use the debugger to tackle the problem ?

Does halInit() bail out, or does it crash ?

Martin.Sergio
Associate III
Posted on March 25, 2013 at 15:45

When I began to debug into the function halInit(); I realize that makes several calls to functions that do not encounter such as:

halInit();-->halInternalInitAdc();-->stCalibrateVref();

halInit();-->halCommonCalibratePads();-->halMeasureVdd();

In both cases jump to HardFault_Handler();

frankmeyer9
Associate II
Posted on March 25, 2013 at 19:43

As mentioned at the start, I neither have the simpleMac librarynor the board, so I'm unable to verify anything.

On *NIX systems, I would use the

nm

command to list the contents of the lib - not sure how if your toolchain has some ported version, or another tool.

But briefly googling for that lib, and looking at the doc, I've seen it is intended for two different boards. Not sure how the lib handles the hardware differences on the lowest layer (i.e. the functions you are missing). On source level, there is usually a #define to specify the target hardware, and differ between those versions. Maybe you need to define one of those in your code/project ?

I wonder that you don't get a linker error. Does you project link in some

__weak

, empty versions for this functions ?

Martin.Sergio
Associate III
Posted on March 26, 2013 at 09:32

Thank you very much for all the help that you're paying me

http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/firmware/stm32w_simplemac_fw.zip

is all related with SimpleMAC Library (headers, sources, library, code examples...) provided by ST, i'm traying to compile and run the ''talk'' example.

The only __weak i found are the IRQ Handlers

Where do you see it is intended for two different boards?

I never used nm comand, but in the out.txt file you can see the output of the command arm-none-eabi-nm simplemac-library.a

________________

Attachments :

out.txt : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtYT&d=%2Fa%2F0X0000000aRh%2Fi6WJk7kVw2iTCwKyE9gX4Pxd4wqf4CUon6DcQ1UKu8A&asPdf=false
frankmeyer9
Associate II
Posted on March 26, 2013 at 14:34

Actually, it supports more than two boards - see CD00262339.pdf

(MB850A, MB851, MB954, MB950A + MB953, MB951).

I never used nm comand, but in the out.txt file you can see the output of the command arm-none-eabi-nm simplemac-library.a

 

That's fine, and it reveals that those functions like stCalibrateVref() are present in the lib. I can't see an obvious reason to hardfault.

But I've seen one thing suspicious. The lib contains entries like __iar_cc..eSdGjFFTt$1 and __iar_systems$$module. Not sure what they are good for, but generally the source differs between an IAR branch and a GNU branch. There is even a GNU version of the lib, as seen here:

https://github.com/contiki-os/contiki/blob/master/cpu/stm32w108/simplemac/library/simplemac-library-gnu.a

AFAIK Codsourcery is basically some Gnu variant, so I would also go for the Gnu variant of the library to link in.

Otherwise, I would try the debugging approach, and check where it actually fails. I wouldn't wonder if it had to do with this mentioned IAR functions. I don't use IAR, so I'm not an expert here.

Martin.Sergio
Associate III
Posted on March 26, 2013 at 15:33

The support of the different boards is for the peripherals (Leds, Buttons...), but, i think, the SimpleMAC library is for the micro, and you can use it in your own board because the radio module is ''inside'' the micro.

ST provide an other template for this example (talk) for the Keil MDK-ARM environment and it works with the Library (simplemac-library.lib)

After i will try link with Contiki's simplemac-library , which not provide ST

http://www.keil.com/arm/

Martin.Sergio
Associate III
Posted on March 26, 2013 at 16:03

if i change the simplemac-library.a for simplemac-library-gnu.a

Output:

arm-none-eabi-ld -nostartfiles -static -T Projects\SimpleMAC\talk\/link.ld -M -Map=talk.map --gc-sections -L /CodeSourcery/CodeSourcery20120963/arm-none-eabi/lib/thumb2 -L /CodeSourcery/CodeSourcery20120963/lib/gcc/arm-none-eabi/4.7.2/thumb2 -L SimpleMAC/Binary -o talk.axf obj/startup.o obj/context-switch.o obj/talk.o obj/syscalls.o obj/stm32w108xx_it.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_adc.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_clk.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_exti.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_flash.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_gpio.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_misc.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_pwr.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_rst.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_sc.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_slptim.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_tim.o STM32W108xx_StdPeriph_Driver/obj/stm32w108xx_wdg.o STM32W108xx_StdPeriph_Driver/obj/system_stm32w108xx.o Utilities/STM32_EVAL/Common/obj/mbxxx_adc_tsensor.o Utilities/STM32_EVAL/Common/obj/mbxxx_i2c_ee.o Utilities/STM32_EVAL/Common/obj/mbxxx_i2c_lis302dl.o Utilities/STM32_EVAL/MB851/obj/mb8o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/board.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/hal_adc.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/hal_clocks.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/hal_flash.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/hal_uart.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/mfg-token.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/micro.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/micro-common.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/micro-common-internal.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/nvm.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/sleep.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/system-timer.o Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/stm32w108/low_level_init.o --start-group -lc -lgcc -lsimplemac-library-gnu --end-group

obj/talk.o: In function `powerFromBatteries':

Projects\SimpleMAC\talk\/talk.c:375: undefined reference to `halMeasureVdd'

Projects\SimpleMAC\talk\/talk.c:382: undefined reference to `halMeasureVdd'

Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/hal_adc.o: In function `halInternalInitAdc':

Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/hal_adc.c:257: undefined reference to `stCalibrateVref'

Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/obj/micro-common-internal.o: In function `halCommonCalibratePads':

Utilities/STM32W108xx_HAL_Driver/micro/cortexm3/micro-common-internal.c:71: undefined reference to `halMeasureVdd'

SimpleMAC/Binary\libsimplemac-library-gnu.a(phy-min.o): In function `readAdcTemperatureChannel':

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xx/phy.c:868: undefined reference to `calStartAdcConversion'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xx/phy.c:873: undefined reference to `calReadAdcBlocking'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xx/phy.c:874: undefined reference to `calDisableAdc'

SimpleMAC/Binary\libsimplemac-library-gnu.a(phy-min.o): In function `stmRadioGetRandomNumbers':

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xx/phy.c:820: undefined reference to `calStartAdcConversion'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xx/phy.c:829: undefined reference to `calReadAdcBlocking'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xx/phy.c:830: undefined reference to `calReadAdcBlocking'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xx/phy.c:841: undefined reference to `calDisableAdc'

SimpleMAC/Binary\libsimplemac-library-gnu.a(analogue-min.o): In function `stmRadioSetChannel':

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue.c:900: undefined reference to `calDisableAdc'

SimpleMAC/Binary\libsimplemac-library-gnu.a(analogue-lna-min.o): In function `stmRadioCalibrateLna':

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:235: undefined reference to `calStartAdcConversion'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:240: undefined reference to `calReadAdcBlocking'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:241: undefined reference to `calStartAdcConversion'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:246: undefined reference to `calReadAdcBlocking'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:275: undefined reference to `calStartAdcConversion'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:286: undefined reference to `calStartAdcConversion'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:293: undefined reference to `calReadAdcBlocking'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:302: undefined reference to `calReadAdcBlocking'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:310: undefined reference to `calStartAdcConversion'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:316: undefined reference to `calReadAdcBlocking'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:356: undefined reference to `calStartAdcConversion'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:362: undefined reference to `calReadAdcBlocking'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:416: undefined reference to `calStartAdcConversion'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-lna.c:422: undefined reference to `calReadAdcBlocking'

SimpleMAC/Binary\libsimplemac-library-gnu.a(analogue-mod-dac-min.o): In function `vcoTuneModDacError':

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-mod-dac.c:90: undefined reference to `calDisableAdc'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-mod-dac.c:97: undefined reference to `calStartAdcConversion'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-mod-dac.c:102: undefined reference to `calReadAdcBlocking'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-mod-dac.c:114: undefined reference to `calDisableAdc'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-mod-dac.c:123: undefined reference to `calStartAdcConversion'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/analogue-mod-dac.c:128: undefined reference to `calReadAdcBlocking'

SimpleMAC/Binary\libsimplemac-library-gnu.a(phy-common-min.o): In function `stmRadioWakeUp':

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/phy-common.c:658: undefined reference to `_disableBasePri'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/phy-common.c:658: undefined reference to `_writeBasePri'

SimpleMAC/Binary\libsimplemac-library-gnu.a(phy-common-min.o): In function `stmRadioSleep':

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/phy-common.c:554: undefined reference to `_disableBasePri'

J:\ccviews\stm32w-dev\simplemac\source/stack/phy/stm32w108xxclass/phy-common.c:648: undefined reference to `_writeBasePri'

SimpleMAC/Binary\libsimplemac-library-gnu.a(aes-min.o): In function `stmAesEncrypt':

J:\ccviews\stm32w-dev\simplemac\source/stack/platform/micro/cortexm3/aes.c:80: undefined reference to `_disableBasePri'

J:\ccviews\stm32w-dev\simplemac\source/stack/platform/micro/cortexm3/aes.c:80: undefined reference to `_writeBasePri'

make: *** [talk.axf] Error 1

And the nm comand return out.txt

________________

Attachments :

out.txt : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtYd&d=%2Fa%2F0X0000000aRi%2FSTYOt_pxRtcpdjp9A1WCN1MjLunzkPDOmYAtW_CMgiI&asPdf=false
frankmeyer9
Associate II
Posted on March 26, 2013 at 16:18

That seems to require the files in  .../simpleMAC/Utilities/STM32W108xx_HAL_Driver/micro/cortexm3. Did you include it in your project ?

As I understood it, the lowest level functionality (HAL layer) is not included in the lib, so you can easily make adaptions.

frankmeyer9
Associate II
Posted on March 26, 2013 at 16:18

Double post, freaking forum software ;-(((