<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Port an MBED design to non-MBED - Phase 1: compile without errors</title><link>/technologies/embedded/b/blog/posts/port-an-mbed-design-to-non-mbed---phase-1-compile-without-errors</link><description>There are many good MBED examples. It&amp;#39;s a popular platform, supported by many manufacturers.Here&amp;#39;s my story on how to port one of those excellent MBED example program to another platform. The program I want to port is the SemTech LoRa Ping-Pong ...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Port an MBED design to non-MBED - Phase 1: compile without errors</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/port-an-mbed-design-to-non-mbed---phase-1-compile-without-errors</link><pubDate>Mon, 11 Nov 2019 17:14:01 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a400c0b4-5282-4e47-b5cf-7ca77962ae97</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Some further progress&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The non-working project now compiles with 3 warnings left:&lt;/p&gt;&lt;p&gt;&lt;span&gt;[View:/resized-image/__size/546x173/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-a400c0b4-5282-4e47-b5cf-7ca77962ae97/contentimage_5F00_192874.png:546:173]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The first one I have to look into. I&amp;#39;m using the correct linker file for my controller but one source somewhere seems to have a sections pragma.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The 2 others are to be ignored, because they are a result of me commenting out code dependencies for things I have to write.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Here are the to-dos to get the cycle closed:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:3ef06e6b-9b7d-4651-b12d-db8be7f5e991:type=text&amp;amp;text=TODO+DigitalIn.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+11+C%2FC%2B%2B+Task%0ATODO+DigitalInOut.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+11+C%2FC%2B%2B+Task%0ATODO+DigitalInOut.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+15+C%2FC%2B%2B+Task%0ATODO+DigitalInOut.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+22+C%2FC%2B%2B+Task%0ATODO+DigitalInOut.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+27+C%2FC%2B%2B+Task%0ATODO+DigitalInOut.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+33+C%2FC%2B%2B+Task%0ATODO+DigitalInOut.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+38+C%2FC%2B%2B+Task%0ATODO+DigitalOut.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+11+C%2FC%2B%2B+Task%0ATODO+DigitalOut.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+18+C%2FC%2B%2B+Task%0ATODO+DigitalOut.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+25+C%2FC%2B%2B+Task%0ATODO+InterruptIn.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+11+C%2FC%2B%2B+Task%0ATODO+SPI.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+11+C%2FC%2B%2B+Task%0ATODO+SPI.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+15+C%2FC%2B%2B+Task%0ATODO+SPI.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+20+C%2FC%2B%2B+Task%0ATODO+SPI.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+24+C%2FC%2B%2B+Task%0ATODO+%3D+fix+this-%3EdioIrq%5B5%5D+%3D+NULL%3B+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+68+C%2FC%2B%2B+Task%0ATODO+Auto-generated+constructor+stub+SemTechSx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp+line+126+C%2FC%2B%2B+Task%0ATODO+Auto-generated+constructor+stub+Timeout.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+11+C%2FC%2B%2B+Task%0ATODO+Auto-generated+destructor+stub+SemTechSx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp+line+131+C%2FC%2B%2B+Task%0ATODO+Auto-generated+destructor+stub+Timeout.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fimplementation_dependent%2Fclient_platform+line+16+C%2FC%2B%2B+Task%0ATODO+fix+tmath+dependencies+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+528+C%2FC%2B%2B+Task%0ATODO+fix+tmath+dependencies+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+578+C%2FC%2B%2B+Task%0ATODO+fix+tmath+dependencies+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+829+C%2FC%2B%2B+Task%0ATODO+fix%2Fport+++++++++++++if%28+this-%3EdioIrq%5B4%5D+%3D%3D+NULL+%29+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+1469+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+1+%29%3B+sx1276-hal.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+95+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+1+%29%3B+sx1276-hal.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+105+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+1+%29%3B+sx1276-hal.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+304+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+1+%29%3B+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+108+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+1+%29%3B+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+147+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+1+%29%3B+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+665+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+10+%29%3B+SemTechSx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp+line+228+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+10+%29%3B+SemTechSx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp+line+243+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+10+%29%3B+SemTechSx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp+line+268+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+10+%29%3B+SemTechSx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp+line+302+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+10+%29%3B+SemTechSx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp+line+321+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+10+%29%3B+SemTechSx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp+line+332+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+10+%29%3B+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+56+C%2FC%2B%2B+Task%0ATODO+implement+wait_ms%28+6+%29%3B+sx1276-hal.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+306+C%2FC%2B%2B+Task%0ATODO+implement+wait%28+1+%29%3B+SemTechSx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp+line+158+C%2FC%2B%2B+Task%0ATODO+implement+wait%280.1%29%3B+sx1276-hal.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+140+C%2FC%2B%2B+Task%0ATODO+port+SX1276MB1xAS+Radio%28+NULL+%29%3B+SemTechSx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp+line+104+C%2FC%2B%2B+Task%0ATODO+port+this.+It+was+too+complex+to+just+move+to+missing.h+sx1276-hal.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+153+C%2FC%2B%2B+Task%0ATODO+port+this.+It+was+too+complex+to+just+move+to+missing.h+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+925+C%2FC%2B%2B+Task%0ATODO+port+this.+It+was+too+complex+to+just+move+to+missing.h+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+980+C%2FC%2B%2B+Task%0ATODO+port+this.+It+was+too+complex+to+just+move+to+missing.h+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+1121+C%2FC%2B%2B+Task%0ATODO+port+this.+It+was+too+complex+to+just+move+to+missing.h+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+1209+C%2FC%2B%2B+Task%0ATODO+port+this.+It+was+too+complex+to+just+move+to+missing.h+sx1276.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+1259+C%2FC%2B%2B+Task%0ATODO+set+for+client+board+sx1276-hal.cpp+%2FTMS570LC43_semtech_sx1276_cpp%2Fcpp%2Fsx1276%2Fsx1276+line+137+C%2FC%2B%2B+Task]&lt;/p&gt;&lt;div&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;A lot of work but many are repeats.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;1 to 15 and 48 are code I need to write.&lt;/li&gt;&lt;li&gt;17 to 20 are empty constructors and destructors. Some need work, some can stay empty&lt;/li&gt;&lt;li&gt;21 to 23 are a little harder to resolve because I may have stumbled on a &lt;a class="jive-link-external-small" href="https://e2e.ti.com/support/tools/ccs/f/81/t/710494?Compiler-TMS570LS3137-TI-v18-1-2-LTS-compiler-error-when-including-string-C-" rel="nofollow ugc noopener" target="_blank"&gt;know error of my compiler&lt;/a&gt;. I may have to provide an own implementation for 3 tmath functions.&lt;/li&gt;&lt;li&gt;25 to 40 can be fixed in a single throw. Just need to write 2 functions that implement wait() and wait_ms() for the target controller&lt;/li&gt;&lt;li&gt;42 to 47 are the callback mechanism for interrupts. Todo.&lt;/li&gt;&lt;li&gt;16 and 41: random activities&lt;/li&gt;&lt;/ul&gt;&lt;img src="https://community.element14.com/aggbug?PostID=8170&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Port an MBED design to non-MBED - Phase 1: compile without errors</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/port-an-mbed-design-to-non-mbed---phase-1-compile-without-errors</link><pubDate>Sun, 10 Nov 2019 20:34:21 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a400c0b4-5282-4e47-b5cf-7ca77962ae97</guid><dc:creator>shabaz</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hi Jan,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This is really great progress. This will be extremely useful to anyone who wishes to work with LoRa!&lt;/p&gt;&lt;p&gt;Regarding interrupt handling, if you&amp;#39;re trying to make it cross-platform to work without an OS too, I&amp;#39;m sure you have your favourite methods to do it, for what it&amp;#39;s worth for hobby stuff I sometimes I just have a timer tick always running (say every millisecond or ten millisec), and execute my state machine in there (since that doesn&amp;#39;t take much overhead and executes quickly). Then, any messages to the state machine just become the setting of variables, and similarly any code that needs to be executed by the state machine is another variable change.. and a main while forever loop handles each message at a time. This is super-basic and full of holes if not done carefully, but at least is supported everywhere that a timer tick or periodic function works, and doesn&amp;#39;t need threads either, nor C++. On larger systems there&amp;#39;s the luxury of using actual real-time middleware of course, but that turns it all into a more major project.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=8170&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Port an MBED design to non-MBED - Phase 1: compile without errors</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/port-an-mbed-design-to-non-mbed---phase-1-compile-without-errors</link><pubDate>Sun, 10 Nov 2019 20:15:08 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a400c0b4-5282-4e47-b5cf-7ca77962ae97</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;... next steps are to solve those parts that are not strictly MBED dependencies, but C++ dependencies that are resolved somewhere in th MBED includes.&lt;/p&gt;&lt;p&gt;I have these instances:&lt;/p&gt;&lt;p&gt;memory copy and I/O (not gpio) functions&lt;/p&gt;&lt;p&gt;ceil, floor and rint templates.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The memory copy functions are declared in the following headers&lt;/p&gt;&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:3ef06e6b-9b7d-4651-b12d-db8be7f5e991:type=c_cpp&amp;amp;text=%23include+%3Cstdio.h%3E%0A%23include+%3Cstring.h%3E]&lt;/p&gt;&lt;div&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;ceil, floor and rint in this one:&lt;/p&gt;&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:3ef06e6b-9b7d-4651-b12d-db8be7f5e991:type=c_cpp&amp;amp;text=%23include+%3Ctgmath.h%3E]&lt;/p&gt;&lt;div&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have added a header file called includes.h to my implementation, in the subfolder &amp;quot;client_platform&amp;quot;&lt;/p&gt;&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:3ef06e6b-9b7d-4651-b12d-db8be7f5e991:type=c_cpp&amp;amp;text=%2F*%0A+*+includes.h%0A+*%0A+*++Created+on%3A+10+nov.+2019%0A+*++++++Author%3A+jancu%0A+*%2F%0A%0A%23ifndef+CPP_IMPLEMENTATION_DEPENDENT_CLIENT_PLATFORM_INCLUDES_H_%0A%23define+CPP_IMPLEMENTATION_DEPENDENT_CLIENT_PLATFORM_INCLUDES_H_%0A%0A%23include+%22.%2Fclient_platform%2Fhard_includes.h%22%0A%23include+%3Cstdio.h%3E%0A%23include+%3Cstring.h%3E%0A%0A%2F%2F+for+ceil%2C+floor%2C+rint%3A%0A%23include+%3Ctgmath.h%3E%0A%0A%23endif+%2F*+CPP_IMPLEMENTATION_DEPENDENT_CLIENT_PLATFORM_INCLUDES_H_+*%2F]&lt;/p&gt;&lt;div&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;this one will have all required standard C++ header includes that are available for MBED programs via the MBED headers.&lt;/p&gt;&lt;p&gt;There&amp;#39;s also a specific include:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:3ef06e6b-9b7d-4651-b12d-db8be7f5e991:type=c_cpp&amp;amp;text=%23include+%22.%2Fclient_platform%2Fhard_includes.h%22]&lt;/p&gt;&lt;div&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;That file will not be part of the device independent port.&lt;/p&gt;&lt;p&gt;Any implementer (read: me) will have to provide it, and put device dependent neccesary includes there that are needed to compile the solution.&lt;/p&gt;&lt;p&gt;There will alse be room for&amp;nbsp; a &amp;quot;client_platform&amp;quot; location to put the device dependent implementation code.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The deal is that you&amp;#39;d (I&amp;#39;d) have to adapt only files in the external &amp;quot;client_platform&amp;quot; folder to make the library work for different microcontroller families.&lt;/p&gt;&lt;p&gt;A more advanced way of doing this is by creating abstract classes that would need to be implemented by your personal C++ device dependent classes.&lt;/p&gt;&lt;p&gt;That&amp;#39;s for later. No use in abstracting something I don&amp;#39;t have working yet.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;em&gt;edit: the goal is that you&amp;#39;d only have to modify files in the external client_platform sources. And that the rest is an as clean as possible port from MBED.&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;I could make it less-intrusive by calling my header file mbed.h instead of includes.h. In that case non of the MBED dependent sources would need to change. But that would give a signal that the support lib is mbed, while it isn&amp;#39;t.&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;I&amp;#39;d even have to use the mbed namespace in my code, and that&amp;#39;s a nono&lt;/em&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=8170&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Port an MBED design to non-MBED - Phase 1: compile without errors</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/port-an-mbed-design-to-non-mbed---phase-1-compile-without-errors</link><pubDate>Sun, 10 Nov 2019 19:48:33 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a400c0b4-5282-4e47-b5cf-7ca77962ae97</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;The main functionality I&amp;#39;m missing at this point is difital GPIO and SPI and interrupt callbacks.&lt;/p&gt;&lt;p&gt;It should not be too hard to come up with a design for the first two that&amp;#39;s close to the MBED design.&lt;/p&gt;&lt;p&gt;The interrupt callback mechanism is based on templates. I understand templates but there&amp;#39;s significant reading and reverse engineering to be done for that.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;If there&amp;#39;s an MBED guru here on the forum that can explain or help abstract out the callback mechanism, that would be welcome (and a time-speed-upper).&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=8170&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>