Particle 0.5.0 Merged


#1

For those who would like to play with the latest and greatest, we have merged Particle 0.5.0 into the bluz firmware.

This is still a bit experimental at the moment, we have done some basic testing but not every feature has been verified. You can get the latest code from the gateway_develop branch here: https://github.com/bluzDK/bluzDK-firmware/tree/gateway_develop

Also note that this branch will soon become the new Mater branch. The current Master branch is develop, but as soon as we are relatively confident that the 0.5.0 merge was successful, we will rename develop to develop_legacy and gateway_develop will become develop and hence the new Master branch.

Also, this branch can now be used to compile for both bluz and the bluz gateway. Just change the make arguments as such:

make PLATFORM=bluz APP=tinker
-or-
make PLATFORM=bluz-gw APP=tinker

And you only need one branch moving forward.

EDIT: All changes to the renaming and changing around are done. If you were working locally, you should make sure you are on the new master branch (called develop) and do a git pull. This will update you to the latest code.


#2

@eric, I grabbed the gateway_develop repo, switched to the modules folder and compiled using make clean all PLATFORM=bluz, PARTICLE_DEVELOP=1 and got this error:

make[1]: *** No rule to make target `../../../build/target/dynalib/arm-m0/libdyn
alib.a', needed by `../../../build/target/user-part/platform-103-m/user-part.elf
'.  Stop.
make[1]: Leaving directory `C:/SPARK/BluzBeta/Gateway/bluzDK-firmware/modules/bl
uz/user-part'
make: *** [C:/SPARK/BluzBeta/Gateway/bluzDK-firmware/modules/bluz/user-part/make
file] Error 2

Any thoughts?


#3

I saw a similar issue at the end of the day. This is gonna sound weird, but build once with ‘clean all’ and it will fail. Then remove the ‘clean all’ and build again, it will succeed.

Clearly I need to track that issue down, by it will build properly on the second try. Not sure why that is happening now, must be some merge issue, but I am working on it


#4

So i just changed and managed to get this built with the changes to system space and user space. still works well!

confirmed working with i2c to the sparkfunIMU (still doesn’t mean i can fix the maths to get a meaningful heading)


#5

@eric I just tried building the GW firmware on this and get the following error. i tried clean all and then removing the clean all as you mentioned above…

In file included from ../../../rt-dynalib/inc/rt_dynalib.h:25:0,
                 from src/export_rt.c:4:
../../../rt-dynalib/inc/rt_dynalib.h:38:62: error: unknown type name 'va_list'
 DYNALIB_FN(9, rt, vsnprintf, int(char*, size_t, const char*, va_list))
                                                              ^
../../../dynalib/inc/dynalib.h:65:56: note: in definition of macro 'DYNALIB_FN_EXPORT'
     __builtin_choose_expr(__builtin_types_compatible_p(type, __typeof__(name)), (const void*)&name, sizeof(struct { \
                                                        ^
../../../rt-dynalib/inc/rt_dynalib.h:38:1: note: in expansion of macro 'DYNALIB_FN'
 DYNALIB_FN(9, rt, vsnprintf, int(char*, size_t, const char*, va_list))
 ^
../../../dynalib/inc/dynalib.h:65:62: error: expected expression before '__typeof__'
     __builtin_choose_expr(__builtin_types_compatible_p(type, __typeof__(name)), (const void*)&name, sizeof(struct { \
                                                              ^
../../../dynalib/inc/dynalib.h:93:9: note: in expansion of macro 'DYNALIB_FN_EXPORT'
         DYNALIB_FN_EXPORT(index, tablename, name, type)
         ^
../../../rt-dynalib/inc/rt_dynalib.h:38:1: note: in expansion of macro 'DYNALIB_FN'
 DYNALIB_FN(9, rt, vsnprintf, int(char*, size_t, const char*, va_list))
 ^
../../../dynalib/inc/dynalib.h:65:78: error: expected ',' or ';' before ')' token
     __builtin_choose_expr(__builtin_types_compatible_p(type, __typeof__(name)), (const void*)&name, sizeof(struct { \
                                                                              ^
../../../dynalib/inc/dynalib.h:93:9: note: in expansion of macro 'DYNALIB_FN_EXPORT'
         DYNALIB_FN_EXPORT(index, tablename, name, type)
         ^
../../../rt-dynalib/inc/rt_dynalib.h:38:1: note: in expansion of macro 'DYNALIB_FN'
 DYNALIB_FN(9, rt, vsnprintf, int(char*, size_t, const char*, va_list))
 ^
../../../dynalib/inc/dynalib.h:67:76: error: expected identifier or '(' before ')' token
             "Signature of the dynamically exported function has changed");})),
                                                                            ^
../../../dynalib/inc/dynalib.h:93:9: note: in expansion of macro 'DYNALIB_FN_EXPORT'
         DYNALIB_FN_EXPORT(index, tablename, name, type)
         ^
../../../rt-dynalib/inc/rt_dynalib.h:38:1: note: in expansion of macro 'DYNALIB_FN'
 DYNALIB_FN(9, rt, vsnprintf, int(char*, size_t, const char*, va_list))
 ^
../../../dynalib/inc/dynalib.h:67:76: error: expected identifier or '(' before ')' token
             "Signature of the dynamically exported function has changed");})),
                                                                            ^
../../../dynalib/inc/dynalib.h:93:9: note: in expansion of macro 'DYNALIB_FN_EXPORT'
         DYNALIB_FN_EXPORT(index, tablename, name, type)
         ^
../../../rt-dynalib/inc/rt_dynalib.h:39:1: note: in expansion of macro 'DYNALIB_FN'
 DYNALIB_FN(10, rt, vsniprintf, int(char*, size_t, const char*, va_list))
 ^
../../../dynalib/inc/dynalib.h:67:76: error: expected identifier or '(' before ')' token
             "Signature of the dynamically exported function has changed");})),
                                                                            ^
../../../dynalib/inc/dynalib.h:93:9: note: in expansion of macro 'DYNALIB_FN_EXPORT'
         DYNALIB_FN_EXPORT(index, tablename, name, type)
         ^
../../../rt-dynalib/inc/rt_dynalib.h:40:1: note: in expansion of macro 'DYNALIB_FN'
 DYNALIB_FN(11, rt, abort, void(void))
 ^
../../../dynalib/inc/dynalib.h:67:76: error: expected identifier or '(' before ')' token
             "Signature of the dynamically exported function has changed");})),
                                                                            ^
../../../dynalib/inc/dynalib.h:93:9: note: in expansion of macro 'DYNALIB_FN_EXPORT'
         DYNALIB_FN_EXPORT(index, tablename, name, type)
         ^
../../../rt-dynalib/inc/rt_dynalib.h:41:1: note: in expansion of macro 'DYNALIB_FN'
 DYNALIB_FN(12, rt, _malloc_r, void*(struct _reent*, size_t))
 ^
../../../dynalib/inc/dynalib.h:67:76: error: expected identifier or '(' before ')' token
             "Signature of the dynamically exported function has changed");})),
                                                                            ^
../../../dynalib/inc/dynalib.h:93:9: note: in expansion of macro 'DYNALIB_FN_EXPORT'
         DYNALIB_FN_EXPORT(index, tablename, name, type)
         ^
../../../rt-dynalib/inc/rt_dynalib.h:42:1: note: in expansion of macro 'DYNALIB_FN'
 DYNALIB_FN(13, rt, _free_r, void(struct _reent*, void*))
 ^
../../../dynalib/inc/dynalib.h:67:76: error: expected identifier or '(' before ')' token
             "Signature of the dynamically exported function has changed");})),
                                                                            ^
../../../dynalib/inc/dynalib.h:93:9: note: in expansion of macro 'DYNALIB_FN_EXPORT'
         DYNALIB_FN_EXPORT(index, tablename, name, type)
         ^
../../../rt-dynalib/inc/rt_dynalib.h:43:1: note: in expansion of macro 'DYNALIB_FN'
 DYNALIB_FN(14, rt, _realloc_r, void*(struct _reent*, void*, size_t))
 ^
make[1]: *** [../../../build/target/system-part1/platform-269-m/./src/export_rt.o] Error 1
make[1]: Leaving directory `C:/Bluz/bluzDK-firmware-gateway_develop/modules/bluz-gw/system-part1'
make: *** [C:/Bluz/bluzDK-firmware-gateway_develop/modules/bluz-gw/system-part1/makefile] Error 2

#6

Thanks, I think I know what the issue is and I will try and fix it quickly.

There was quite a lot of changes in 0.5.0 and it caused some problems, especially around the dynamic functions which is where this error lies.


#7

Ok, this is fixed. I had it fixed, just in the wrong directory and was building the wrong place. Merges make everything so confusing :smile:

If you get latest you can build for both bluz and the gateway now. There is still the strange “you have to build twice” issue going on, I haven’t really had a chance to look at that yet. If anyone submits a PR to fix that issue, I will send you a free DK!


#8

@eric, with Particle, I recall a problem with building where I could not do a clean all build as it deleted files before they could be linked! I posted an issue and Mat fixed the problem. This was in the past 2 or 3 weeks. The problem may be related depending on when you pulled 0.5.0. The workaround was to do a make clean then a make all separately. :wink:


#9

Ok, that sounds like what is going on here. I will try and look through the logs to see where Mat fixed it and pull in the change.

We pulled 0.5.0 directly from the latest release, so we have whatever is in the 0.5.0 release branch.


#10

@eric, the fix was deployed in develop but not sure about latest.


#11

Huh, I see the issue on their repo and the fix where Mat checked it in here: https://github.com/spark/firmware/commit/cde57d109105e40821041b9e8ece496a0d18ae7f

Still, if I try that, I am getting the error still. @peekay123 this is fixed in the latest Particle develop branch?

Unfortunately I don’t have time to keep playing with it right now, so the free DK for a PR is still open if someone whats to give it a shot!


#12

I decided to update my gateway tonight with the Develop branch, all seemed to go ok but now it seems to be in some sort of boot loop… connects ok to the cloud then drops out, then connects and drops out over and over again…

here is the serial output from the photon this from power up, photon connects, nrf connects and then disconnects 3 seconds later (according to my dashboard)

12875:DEBUG: In SPI Receive
12875:DEBUG: Handshake complete
12877:DEBUG: Receiving SPI data of size 6
12877:DEBUG: Reading chunk of size 6
12879:DEBUG: Processing message of size 3 with clientID 0 and service ID 1
12880:DEBUG: Disconnecting Client0
12880:DEBUG: Read length = 1
12882:DEBUG: In SPI Receive
12882:DEBUG: Handshake complete
12884:DEBUG: Receiving SPI data of size 6
12884:DEBUG: Reading chunk of size 6
12886:DEBUG: Processing message of size 3 with clientID 1 and service ID 1
12887:DEBUG: Disconnecting Client1
12887:DEBUG: Read length = 1
12888:DEBUG: In SPI Receive
12888:DEBUG: Handshake complete
12890:DEBUG: Receiving SPI data of size 6
12890:DEBUG: Reading chunk of size 6
12892:DEBUG: Processing message of size 3 with clientID 2 and service ID 1
12893:DEBUG: Disconnecting Client2
12893:DEBUG: Read length = 1
12894:DEBUG: In SPI Receive
12894:DEBUG: Handshake complete
12896:DEBUG: Receiving SPI data of size 6
12896:DEBUG: Reading chunk of size 6
12898:DEBUG: Processing message of size 3 with clientID 3 and service ID 1
12899:DEBUG: Disconnecting Client3
12899:DEBUG: Read length = 1
14907:DEBUG: In SPI Receive
14907:DEBUG: Handshake complete
14909:DEBUG: Receiving SPI data of size 28
14909:DEBUG: Reading chunk of size 28
14912:DEBUG: Processing message of size 25 with clientID 3 and service ID 1
14912:DEBUG: Connecting Client3
15493:DEBUG: Read length = 23
15563:DEBUG: Starting to send data
15613:DEBUG: Completed Sending
15614:DEBUG: 3->BLE    - 45
17578:DEBUG: In SPI Receive
17578:DEBUG: Handshake complete
17580:DEBUG: Receiving SPI data of size 261
17580:DEBUG: Reading chunk of size 255
17587:DEBUG: Reading chunk of size 6
17589:DEBUG: Processing message of size 258 with clientID 3 and service ID 1
17590:DEBUG: 3->Cloud  - 256
17590:DEBUG: Read length = 256
17925:DEBUG: Starting to send data
18031:DEBUG: Completed Sending
18032:DEBUG: 3->BLE    - 389
20482:DEBUG: In SPI Receive
20482:DEBUG: Handshake complete
20484:DEBUG: Receiving SPI data of size 23
20484:DEBUG: Reading chunk of size 23
20487:DEBUG: Processing message of size 20 with clientID 3 and service ID 1
20487:DEBUG: 3->Cloud  - 18
20487:DEBUG: Read length = 18
20489:DEBUG: In SPI Receive
20489:DEBUG: Handshake complete
20491:DEBUG: Receiving SPI data of size 23
20491:DEBUG: Reading chunk of size 23
20494:DEBUG: Processing message of size 20 with clientID 3 and service ID 1
20494:DEBUG: 3->Cloud  - 18
20494:DEBUG: Read length = 18
20807:DEBUG: Starting to send data
20857:DEBUG: Completed Sending
20857:DEBUG: 3->BLE    - 23
20857:DEBUG: In SPI Receive
20858:DEBUG: Handshake complete
20860:DEBUG: Receiving SPI data of size 55
20860:DEBUG: Reading chunk of size 55
20863:DEBUG: Processing message of size 52 with clientID 3 and service ID 1
20863:DEBUG: 3->Cloud  - 50
20864:DEBUG: Read length = 50
20867:DEBUG: In SPI Receive
20867:DEBUG: Handshake complete
20869:DEBUG: Receiving SPI data of size 55
20869:DEBUG: Reading chunk of size 55
20872:DEBUG: Processing message of size 52 with clientID 3 and service ID 1
20873:DEBUG: 3->Cloud  - 50
20873:DEBUG: Read length = 50
20875:DEBUG: In SPI Receive
20875:DEBUG: Handshake complete
20877:DEBUG: Receiving SPI data of size 55
20877:DEBUG: Reading chunk of size 55
20880:DEBUG: Processing message of size 52 with clientID 3 and service ID 1
20881:DEBUG: 3->Cloud  - 50
20881:DEBUG: Read length = 50
21009:DEBUG: In SPI Receive
21009:DEBUG: Handshake complete
21011:DEBUG: Receiving SPI data of size 119
21011:DEBUG: Reading chunk of size 119
21015:DEBUG: Processing message of size 116 with clientID 3 and service ID 1
21016:DEBUG: 3->Cloud  - 114
21016:DEBUG: Read length = 114
21019:DEBUG: In SPI Receive
21019:DEBUG: Handshake complete
21021:DEBUG: Receiving SPI data of size 23
21021:DEBUG: Reading chunk of size 23
21024:DEBUG: Processing message of size 20 with clientID 3 and service ID 1
21024:DEBUG: 3->Cloud  - 18
21024:DEBUG: Read length = 18
21027:DEBUG: In SPI Receive
21027:DEBUG: Handshake complete
21029:DEBUG: Receiving SPI data of size 23
21029:DEBUG: Reading chunk of size 23
21032:DEBUG: Processing message of size 20 with clientID 3 and service ID 1
21032:DEBUG: 3->Cloud  - 18
21032:DEBUG: Read length = 18
21125:DEBUG: Starting to send data
21175:DEBUG: Completed Sending
21175:DEBUG: 3->BLE    - 23
21445:DEBUG: Starting to send data
21497:DEBUG: Completed Sending
21497:DEBUG: 3->BLE    - 59
21499:DEBUG: Starting to send data
21550:DEBUG: Completed Sending
21550:DEBUG: 3->BLE    - 59
22058:DEBUG: Starting to send data
22108:DEBUG: Completed Sending
22108:DEBUG: 3->BLE    - 23
23856:DEBUG: In SPI Receive
23856:DEBUG: Handshake complete
23858:DEBUG: Receiving SPI data of size 6
23858:DEBUG: Reading chunk of size 6
23860:DEBUG: Processing message of size 3 with clientID 0 and service ID 1
23861:DEBUG: Disconnecting Client0
23861:DEBUG: Read length = 1
23863:DEBUG: In SPI Receive
23863:DEBUG: Handshake complete
23865:DEBUG: Receiving SPI data of size 6
23865:DEBUG: Reading chunk of size 6
23867:DEBUG: Processing message of size 3 with clientID 1 and service ID 1
23868:DEBUG: Disconnecting Client1
23868:DEBUG: Read length = 1
23871:DEBUG: In SPI Receive
23871:DEBUG: Handshake complete
23873:DEBUG: Receiving SPI data of size 6
23873:DEBUG: Reading chunk of size 6
23875:DEBUG: Processing message of size 3 with clientID 2 and service ID 1
23876:DEBUG: Disconnecting Client2
23876:DEBUG: Read length = 1
23879:DEBUG: In SPI Receive
23879:DEBUG: Handshake complete
23881:DEBUG: Receiving SPI data of size 6
23881:DEBUG: Reading chunk of size 6
23883:DEBUG: Processing message of size 3 with clientID 3 and service ID 1
23884:DEBUG: Disconnecting Client3
23884:DEBUG: Read length = 1
25892:DEBUG: In SPI Receive
25892:DEBUG: Handshake complete
25894:DEBUG: Receiving SPI data of size 28
25894:DEBUG: Reading chunk of size 28
25897:DEBUG: Processing message of size 25 with clientID 3 and service ID 1
25897:DEBUG: Connecting Client3



#13

I saw something very similar in the DK when I first merged. It had to do with sleep mode, the new 0.5.0 branch changed and they started trying to turn off the network connection by default for all sleep modes. We hadn’t tested doing that, and bluz times out and the WDT rebooted it.

That shouldn’t be happening here, though, as the fix for the issue applies to all platforms. It sounds like something else is hanging after than handshake is completed. Just to make sure, can you remove the call to System.sleep() in the loop() function? Or if you have any other code in there, can you remove it?


#14

I did just try this and I didn’t see the same behavior. Are you running any custom user app? Or just tinker?

How are you copying the firmware over? Adalink? Can you post the command?


#15

i did it ota,

particle flash ID system-part-1.bin

might have to do it with adalink now though! do you have pre-compiled binaries i could flash?
luckily i have the adaptor for the little header :slight_smile:


#16

I am trying to build locally and I am getting that same error:

make[2]: *** No rule to make target ../../../build/target/dynalib/arm-m0/libdynalib.a', needed by…/…/…/build/target/user-part/platform-103-m/user-part.elf’. Stop.
make[2]: Leaving directory C:/bluz/bluzDK-firmware/modules/bluz/user-part' make[1]: *** [modules/bluz/user-part] Error 2 make[1]: Leaving directoryC:/bluz/bluzDK-firmware/main’
make: *** [main] Error 2

I tried ‘make clean all’ followed by ‘make’ and it still shows the error


#17

What directory are you building from? Also, what gcc version do you have installed?


#18

I am building from the root folder

GCC is version 5.3.1 20160307


#19

I have not tried that version yet. We officially support 4.8.4 on the build server and recommend 4.9.3 for local compiling. That doesn’t mean it won’t work, just means we haven’t verified it yet.

Also, try compiling from the modules/ folder inside root.


#20

Sorry if I am a bit dense about all of this, I am pretty new to the platform.

I successfully built the latest firmware using 4.9.3 of gcc and the modules folder. I now want to confirm what the next steps are. My goal is to get as much user space as possible.

Should I go ahead and make the code changes you describe here: Available firmware space on Bluz

Then, do I need to copy my application into one of the subfolders in the build hierarchy? Does it go here: \bluzDK-firmware\user\src ?

If I then build I should end up with both firmware and my application. I then can use Particle CLI to do an OTA update? Do I do both separately?

Thanks for all your help. Hopefully I should be self sufficient soon!