Monday 28 November 2016

Using a void* Parameter



ref:
http://www.cplusplus.com/forum/general/50934/
http://stackoverflow.com/questions/3200294/how-do-i-convert-from-void-back-to-int


Bitbucket Daily Use


Daily Use:

git status
git branch

git add -A  // if you put something inside a sub-directory "git add ." won't detect

git commit -m 'accomplished what in this version'

git push origin develop

////////////////////////////////////////////////////////////////////////////////////////////////////////

Troubleshoots:
(0)
error: failed to push some refs to 'https://xxxxx@bitbucket.org/yyyyyyy/zzzzzzzz.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.

git push -f origin master

Force Push...

////////////////////////////////////////////////////////////////////////////////////////////////////////////

ref:
https://www.douban.com/note/525306465/
http://stackoverflow.com/questions/20939648/issue-pushing-new-code-in-github




Friday 18 November 2016

Particle Photon Firmware Dev Get Started Part: error: "BYTE_ORDER" redefined [-Werror]


Yet stuck at:
    make clean all PLATFORM=photon -s program-dfu

And I got:

In file included from ./src/photon/wiced/network/LwIP/WWD/FreeRTOS/arch/cc.h:69:0,
                 from ./src/photon/wiced/network/LwIP/ver1.4.0.rc1/src/include/lwip/arch.h:43,
                 from ./src/photon/wiced/network/LwIP/ver1.4.0.rc1/src/include/lwip/debug.h:35,
                 from ./src/photon/wiced/network/LwIP/ver1.4.0.rc1/src/include/lwip/opt.h:46,
                 from ./src/photon/wiced/network/LwIP/ver1.4.0.rc1/src/include/ipv4/lwip/ip_addr.h:35,
                 from ./src/photon/wiced/network/LwIP/WICED/wiced_network.h:43,
                 from ./src/photon/include/wiced_tcpip.h:44,
                 from ./src/photon/include/wiced.h:46,
                 from src/photon/delay_hal.c:27:
./src/photon/wiced/network/LwIP/WWD/FreeRTOS/cpu.h:43:0: error: "BYTE_ORDER" redefined [-Werror]
 #define BYTE_ORDER LITTLE_ENDIAN
 ^
In file included from /usr/local/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi/include/sys/types.h:67:0,
                 from /usr/local/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi/include/stdio.h:61,
                 from ./src/photon/wiced/WWD/include/wwd_debug.h:40,
                 from ./src/photon/wiced/WWD/include/wwd_assert.h:42,
                 from ./src/photon/wiced/RTOS/FreeRTOS/WWD/ARM_CM3/FreeRTOSConfig.h:41,
                 from ./src/photon/wiced/RTOS/FreeRTOS/ver7.5.2/Source/include/FreeRTOS.h:78,
                 from ./src/photon/wiced/RTOS/FreeRTOS/WWD/wwd_rtos.h:46,
                 from ./src/photon/wiced/WWD/include/RTOS/wwd_rtos_interface.h:47,
                 from ./src/photon/wiced/platform/MCU/STM32F2xx/peripherals/platform_mcu_peripheral.h:56,
                 from ./src/photon/wiced/platform/include/platform_peripheral.h:42,
                 from ./src/photon/include/wiced_platform.h:46,
                 from ./src/photon/include/wiced.h:44,
                 from src/photon/delay_hal.c:27:
/usr/local/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi/include/machine/endian.h:20:0: note: this is the location of the previous definition
 #define BYTE_ORDER _BYTE_ORDER
 ^
cc1: all warnings being treated as errors
../build/module.mk:256: recipe for target '../build/target/hal/platform-6-m/./src/photon/delay_hal.o' failed
make[2]: *** [../build/target/hal/platform-6-m/./src/photon/delay_hal.o] Error 1
../../../build/recurse.mk:11: recipe for target 'hal' failed
make[1]: *** [hal] Error 2
makefile:85: recipe for target '/home/boris/Dropbox/GROBO/Photon/PhotonSystemFirmwareDev/GetStarted/firmware/modules/photon/system-part1/makefile' failed


==========================================================

Seems to have something to do the arm-gcc compiler.

I find the solution in this link: https://github.com/spark/firmware/issues/1054
It turned out that arm gcc 5.4 is too new for Particle Firmware.

So I did everything again using arm gcc 5.3 and it worked!!!!!!!!!!
Don't forget to change the GCC_ARM_PATH.

Particle Photon Firmware Dev Get Started Part: ARM GCC Compiler Not Found Issue


I followed this link to install my ARM GCC Toolchain:

And I followed this link to start Photon Firmware development:

BUT I stuck at:
make clean all PLATFORM=photon -s program-dfu
And I get:

/bin/sh: 1: arm-none-eabi-gcc: not found
../build/arm-tools.mk:43: *** "ARM gcc version 4.8.4 or later required, but found ".  Stop.

This is mentioned in the Common Error and the provided solution is to export the PATH. However, at the end of the first Link above, it mentions that it would be better not to do that. So here is my solution:

(1) Locate file ../build/arm-tools.mk from firmware/modules
We can see all we need to fix is to indicate GCC_ARM_PATH

(2) At the top there is a line : include $(COMMON_BUILD)/common-tools.mk
GCC_ARM_PATH must be in there.

(3) open file ../build/common-tools.mk
We can see:
# GCC_ARM_PATH can be defined to be the path of the GCC ARM compiler,
# It must include a final slash! Default is empty

So I defined right here:
GCC_ARM_PATH = /usr/local/gcc-arm-none-eabi-5_4-2016q3/bin/


Friday 11 November 2016

Arduino Uploading Problem: stk500_recv(): programmer is not responding


This actually works for me:
switch on verbose output during upload (in the arduino IDE preferences pane).


ref:
http://stackoverflow.com/questions/19765037/arduino-sketch-upload-issue-avrdude-stk500-recv-programmer-is-not-respondi

Sunday 6 November 2016

Android Environment Setup





ref:
https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04
http://askubuntu.com/questions/421389/where-to-unpack-the-android-studio-file

http://askubuntu.com/questions/775078/lib32bz2-1-0-missing-on-16-04
http://stackoverflow.com/questions/29916379/unable-to-run-mksdcard-tool-during-android-studio-installation-on-ubuntu-15-04/39567843

http://stackoverflow.com/questions/16579448/how-to-change-or-add-theme-to-android-studio

Ubuntu Chinese Input Method




ref:
http://pinyinjoe.com/linux/ubuntu-12-chinese-setup.htm
http://pinyinjoe.com/linux/ubuntu-10-chinese-input-pinyin-chewing.htm

Wednesday 2 November 2016

Delete Ubuntu Safely with Win 7


(1) Download mbrfix.zip and unzip under root c:\
http://www.sysint.no/mbrfix

(2) Open Windows terminal and input:
cd \
mbrfix /drive 0 fixmbr /yes
(3) reboot
We don't see the grub list any more.

(4) delete the ubuntu partitions.

ref:
http://forum.ubuntu.org.cn/viewtopic.php?t=66401

Tuesday 1 November 2016

Grub Rescue

I got this prompt when I was trying to clear out some Disk from my Win 7 for Ubuntu. Here are the commands I've used to fix the problem.

(1) Find the /boot partition
ls

we can see something like:
(hd0,1),(hd0,5),(hd0,3),(hd0,2)

(2) Try them one by one and if one shows a file "grub.cfg", that is our /boot
ls (hd0,X)/grub -- I remember I have an independent partition for /boot

(3)
grub rescue>set root=(hd0,5)
grub rescue>set prefix=(hd0,5)/grub
grub rescue>insmod normal
grub rescue>normal

We can see our grub list now. BUT!!!!!! It's not over yet.

(4) last step

sudo update-grub
sudo grub-install /dev/sda



ref:
http://forum.ubuntu.org.cn/viewtopic.php?t=348503
http://askubuntu.com/questions/192621/grub-rescue-prompt-repair-grub