Porting to EFM32 #6683
Replies: 1 comment
-
Posted at 2015-12-21 by @gfwilliams Hi, Great! It might be worth reading the Build Process Readme if you haven't already.
This is for STM32 boards, and you can ignore it (at least initially). It's part of the pin definitions stuff that works out On STM32, to get a certain peripheral to work on a certain pin, you have to set that pin's 'alternate function' register to the right number. The CSV file helps the STM32's
On other platforms you generally have some assembly code that gets pulled in that contains the real entrypoint. That initialises the stack pointer, sets up memory, etc, and then finally calls I'd focus on trying to get a simple 'hello world' EFM32 project compiling and working with a Makefile and arm-none-eabi-gcc. Once that's done it's probably a lot easier to get the same thing working with the Espruino Makefile, and to then modify your
I use Eclipse, and build just by running I'd do the same if I were you (using your favourite editor) - trying to use some other toolchain you're just making life a lot harder for yourself! Posted at 2015-12-21 by LaplaceG Thanks! Yup, that's what I'm working on. Just getting a toolchain up running and making main.c blink a LED. But bargh. I'm doing some headbashing here. Basically the Silicon Labs development tools (Simplicity Studio) is based on Eclipse+GCC so it shouldn't be that hard to get it up running right? We don't supply these startup-files as objects, only as assembly or C-files, so if the build system is expecting that I understand that they might be causing problem...? I tried using a pre-defined linker file, and setting the object-file generated from startup_efm32gg.c to a PRECOMPILED_OBJS. Still no luck. Any other suggestions on what might be wrong? I'm using GNU ARM 4.8_2013q4 Posted at 2015-12-21 by @gfwilliams The version of GCC you're using sounds fine... It should be pretty easy to get going - you'd hope :) You shouldn't need object files either... ... actually, is it worth you just using mbed to set up a 'hello world' project? You can then export that to GCC and work from there? Posted at 2015-12-22 by LaplaceG Good tip!
Here's the standard compilation using Simplicity Studio:
And here's the output from the Espruino building at the moment:
I'm totally lost in terms of GCC at the moment. Posting this in a desparate hope that someone might be able to spot the errors... Posted at 2015-12-22 by @gfwilliams You could get rid of Also can you compile with It looks like you're still using Windows as well? If I were you I'd really just install a VM and use Ubuntu with arm-none-eabi-gcc. Trying to change to do the build under windows as well as porting to a new chip is just asking for trouble. There are also some webpages on building for EFM32 with Makefiles too - maybe try one of them... Don't use Espruino at all at the moment but just try and get something building with GCC and a Makefile. Posted at 2016-01-11 by LaplaceG Hi, Thanks for the suggestion. Building for the EFM32 with a makefile also works fine, the mbed output above comes from doing just that. Also, the Gecko SDK comes with all examples created for ARM GCC, and they're all building fine. We have two dev-environments here. Me (the Windows n00b) and Mikael running make in Dokker on a Mac. Both have the same problems. I was just hoping that there would be some GCC wiz here that would immediately spot my mistake, but I guess I'll just have to start at the beginning, removing files and options from the building till it starts working :) Posted at 2016-01-11 by @gfwilliams I'd start looking at the Linker file. The binary should at the very least have a Vector table of 100 bytes or so right at the start of it. However, the linker should throw an error if it can't find the vector table, so I'd assume that for whatever reason the linker file isn't requesting it, or it has been found but is 0 bytes long. Posted at 2016-01-12 by LaplaceG Woah! It's working. Basically the whole setup was correct including the linker file for the EFM32, but I hadn't guarded the generation of the linker file Then, ran into the problem of ALWAYS_INLINE, but setting Right now it's compiling and running, but currently when including the Posted at 2016-01-13 by @gfwilliams Great! The Linker file thing sounds like a pain - perhaps it could only generate it if the path was in the For the Posted at 2016-01-13 by @gfwilliams Actually, some code in Espruino checks where the stack is vs the end of memory, so it tries not to overflow the stack by recursing too far. It could be that you just need to define those variables in the linker file at the right place. In fact I think For _sbrk, often what I do in these cases is define the symbol in a C file, compile it, and the search the assembly code for _sbrk in order to see what is using it (it might be something got pulled in that shouldn't be) Posted at 2016-01-13 by LaplaceG Hi, You guys probably know this already, but I'm just posting the update for further reference if anyone else runs into the same problem. The Undefined reference to `_etext' is because _etext is being used directly from jswrap_process.c here: The reason for the mismatch is that the EFM32 linker (and startup-file) defines this variable as __etext (notice two underscores). So after updating the build_platform_config.py to use this name instead for the LINKER_ETEXT_VAR it's all good. The other undefined references to _sbrk and _exit was solved by adding Posted at 2016-01-28 by LaplaceG Where is this set I've finished implementing the deep sleep functionality so it sleeps for real if waiting for things that take more than 1/2 second but I have to comment out the above line. Of course then the console does not work very well :) I can't see the above flag being set for jsiStatus anywhere? Guessing that it should only be set when a console is not connected? Also, on another note, if I want to use 115200 baud for the console, how do I do it (on the PC side)? Posted at 2016-01-29 by @gfwilliams
The Generally it doesn't sleep if USB is connected (but I think the EFM32 doesn't have USB?) - and yes, since the clocks stop the Serial UART usually dies, and that makes the console almost unusable :) You can hack something up using some JS code and There's a branch where I'm looking at adding software serial - I'm hopeful that (at least for low baud rates) that may be usable from deep sleep.
In the Web IDE? It's under 'settings' and 'communications'. On the Espruino itself you can do Posted at 2016-01-29 by LaplaceG Thanks for the info! It wakes properly to tell me the time every 10 seconds, so I guess so..? Pin wake-up is not yet implemented.. I'm also having a bit of trouble testing the utility timer and Delay() functions. Do you have some simple test-cases for the framework? The EFM32 have USB, but it's not implemented yet :) Actually that touches another comment. If a device has USB, I actually had to change the part-number of the EFM32 to one without USB to make it compile. Posted at 2016-01-29 by @gfwilliams Ahh - I think if the part has USB but USB isn't used, we should make sure it doesn't get defined. Do the EFM32 headers define it then? For the timers, the best thing might be to include the software PWM support (copy it from the top part of AnalogOutput in STM32) and to enable soft PWM on a pin. Hopefully you'll be able to see quite easily if you're scheduling the timers correctly. Also Posted at 2016-01-29 by LaplaceG Yes, The EFM32 headers define K, thanks I will try. Right now I'm struggling to get the setWatch to work correctly (without sleepdeep first). I can send a pull request and you can see if there are some obvious mistakes. Posted at 2016-02-01 by LaplaceG Yup. Got it working. Just USB and analog left and we're good :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-12-21 by LaplaceG
Hi,
I'm on my way to porting Espruino to the EFM32 series of microcontrollers..
I guess I will have more, but right now I have three questions:
Beta Was this translation helpful? Give feedback.
All reactions