Tuesday, November 8, 2016

STM32f429 Discovery on ucLinux: How to run user programs.

The uClinux is able to run on the STMf429 Discovery board.
But...

What should user programs run to do on the boards?


I have two ideas.
  1) User programs write "romfs" on your PC.
  2) User programs transmit via console.

This document explains two methods.

Chapter 1. Writing to "romfs".

The uClinux environment was installed and built successfully, when you see development directory.
pardus@STM32dev:~/src/stm32f429-linux-builder$ ls
busybox-1.22.1  downloads  mk   README.md  stamp-kernel  u-boot
configs         Makefile   out  rootfs     stamp-uboot   uclinux

That "rootfs" is base image of rootfs and user programs write under "rootfs".
Ex. Writung "hello" at /root/

pardus@STM32dev:~/src/stm32f429-linux-builder$ cp ../hello/hello rootfs/root
pardus@STM32dev:~/src/stm32f429-linux-builder$ ls rootfs/root
hello placeholder

Rebuild and reinstallation run on development PC.
pardus@STM32dev:~/src/stm32f429-linux-builder$ make clean-rootfs
pardus@STM32dev:~/src/stm32f429-linux-builder$ make build-rootfs
pardus@STM32dev:~/src/stm32f429-linux-builder$ make install

When rebooted, you can type command on uClinux to see hello program in board file system.
~ # cd root    
/root # ls
hello
/root # ./hello
   Hello World!!    
/root #


Chapter 2. Transmit via Console.

Method Chapter 1 is previously write romfs, but romfs is read-only file system and romfs must rebuild whenever update programs. I want to transmit running on uClinux.

Let see file system by "mount" and "df" command.
~ # mount
rootfs on / type rootfs (rw)
/dev/root on / type romfs (ro,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
/dev/ram0 on /var type ext2 (rw,relatime,errors=continue,user_xattr,acl)

/root # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                  364       364         0 100% /
/dev/ram0                 1003        17       986   2% /var
 

This system has two file device, one is romfs other is ramfs.
"romfs" isn't writing read only but "ramfs" is possible read and write.
There are several method of transfer programs, I adopt simplest method by copy-paste and linux commands.
Using commands are "uuencode" and "uudecode" in busybox, but they wasn't built. Using commands edits busybox configuration file.
   [your development environment]/stm32f429-linux-builder/configs
   busybox_config

There are two configuration way, one is editing two line in that file.
  # CONFIG_UUDECODE is not set
  # CONFIG_UUENCODE is not set
    Change to
  CONFIG_UUDECODE=y
  CONFIG_UUENCODE=y

More one is able to change by "make menuconfig".


You need configuration file Load/Save!

If you use "make menuconfig" when you need previously installing ncurses.
   apt-get install ncurses-dev  

Configure file changed completely then rebuild file system and installing.
Rebuilding previously clean busybox development environment.

pardus@STM32dev:~/src/stm32f429-linux-builder$ cd busybox-1.22.1/
pardus@STM32dev:~/src/stm32f429-linux-builder$ make clean
pardus@STM32dev:~/src/stm32f429-linux-builder$ make mrproper
pardus@STM32dev:~/src/stm32f429-linux-builder$ cd ..
pardus@STM32dev:~/src/stm32f429-linux-builder$ make clean-rootfs
pardus@STM32dev:~/src/stm32f429-linux-builder$ make build-rootfs
      :
pardus@STM32dev:~/src/stm32f429-linux-builder$ make install

Sample program "hello2.c"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {      

    if(argc < 2) {
        printf("I need a arg!\n");
        exit(-1);
    }
    printf("   Hello World!!\n");
    printf("      %s\n", argv[1]);

    exit(0);
}

$ arm-uclinuxeabi-gcc -g -Os -g2 -mthumb -mcpu=cortex-m3 -O2 hello2.c -o hello2 

Binary file "hello2" convert text file use "uuencode" command on development PC.
pardus@STM32dev:~/src/hello2$ uuencode hello2 hello2 > hello2.uu  


if "uuencode" command isn't installed your PC when you install commands.

   apt-get install sharutils  

Created "hello2.uu" show on PC terminal and all slect and copy.
STM32f4 console type command "uudecode" and paste.
~ # cd /var
/var # uudecode
STOP TERMINAL,
AND YOU CAN PASTE "hello2.uu" TEXT FILE.
       :
       :
/var # ./hello2
I need a arg!
/var # ./hello2 hoge
   Hello World!!
      hoge
/var #

However, you want to transfer STM32f4 to PC, when you can use "uuencode" command on STB32f4 and copy text. For example games save data files...


Have a nice computing!


Thursday, October 27, 2016

STM32F3 Discovery + libopencm3, using USART.

I made STM32 development environment by gcc + libopencm3.
libopencm3 examples include using USART  for STM32F429, but STM32F3 is nothing.
So, I refer usart_console program for STM32F4 then successfully run on the STM32F3 discovery board.
I changed USART register name for running on STM32F3.

void console_putc(char c)
{
        uint32_t        reg;
        do {
                reg = USART_ISR(CONSOLE_UART);
        } while ((reg & USART_ISR_TXE) == 0);
        USART_TDR(CONSOLE_UART) = (uint32_t) c & 0xff;
}

char console_getc(int wait)
{
        uint32_t        reg;
        do {
                reg = USART_ISR(CONSOLE_UART);
        } while ((wait != 0) && ((reg & USART_ISR_RXNE) == 0));
        return (reg & USART_ISR_RXNE) ? USART_RDR(CONSOLE_UART) : '\000';
}


USART_ISR is "Interrupt and status register".(STM32F4 is USART_SR)
USART_TDR is "Transmit Data Register".(STM32F4 is USART_DR)
USART_RDR is "Receive Data Register".(STM32F4 is USART_DR)

Some constitution of registers are different from STM32F4 in STM32F3.
  

Have a good your computing!


Tuesday, October 11, 2016

STM32 develop embed programs by gcc environment.

I made development for STM32f429 discovery uClinux environment.
This time, let it add gcc development on my environment. Because, I have STM32f429 discovery and STM32f303 discovery boards.

First: Installing toolchain.
It needs Arm instruction set compiling and working out binary files tools.
And, the binary files are made by ARM non eabi mode instruction set.
It tools called "Toolchain", that you can be able to get running on your PC binaries from the Web.
binutils-arm-none-eabi, gcc-arm-none-eabi

You can install your PC(Ubuntu) by the "apt-get" command.
$ apt-get install binutils-arm-none-eabi gcc-arm-none-eabi

Confirmation passes installing by below command.
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (4.8.2-1ubuntu1+6) 4.8.2
Copyright (C) 2013 Free software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A particular purpose.
$


Next: Installing STM32 firmware.
There is libopencm3 project that is ARM multi platform hardware farmware developing.
I choice that project.

Getting source tree from git command.
$ git clone https://github.com/libopencm3/libopencm3-examples.git<

Making firmware. 
$ cd libopencm3
$ git submodule init
$ git submodule update
$ make


Examples: Getting start !
Showing a STM32f303 discovery board example doing.
$ cd examples/stm32/f3/stm32f3-discovery/miniblink
$ make

Connection your STM32f303 discovery board on your PC via USB cable, and start openocd.
$ sudo openocd -f /usr/local/share/openocd/script/board/stm32f3discovery.cfg

And, you open other terminal and run telnet to connect openocd and flash operations..
$ telnet 4444
reset halt
flash write_image erase miniblink.elf
reset

If successflly write STM32f303 discovery board, when light blue LED !


Showing a STM32f429 discovery board example doing.
To do STM32f429 discovery board is the same STM32f303 doscovery bord.
$ cd examples/stm32/f4/stm32f429-discovery/miniblink
$ make

Connection your STM32f429 discovery board on your PC via USB cable, and start openocd.
$ sudo openocd -f /usr/local/share/openocd/script/board/stm32f429discovery.cfg

And, you open other terminal and run telnet to connect openocd and flash operations.
$ telnet 4444
reset halt
flash write_image erase miniblink.elf
reset

If successflly write STM32f29 discovery board, when light green LED(LED3) !


Flash writing use OpenOCD.
  How to get and install OpemPCD to see old my blog.


Let's enjoy computing !


Monday, October 10, 2016

Soup curry restaurant, "Firi Firi"

The soup curry is a local specialty in Sapporo Hokkaido Japan.
I didn't have time in Sapporo, but I have craving soup curry in Sapporo !
So, I searched soup curry shop nearest the Sapporo station by using Google Map. Finding shop is "Firi Firi 2 gou"(ヒリヒリ2号) that locate under guard. The shop is hard to find and step to the buck of passageway under the guard.

Shop's waitress recommends hot level 3, because if you are first time to eat this restaurant and you love hot. But I want more hot flavor. If I have chance of to visit this restaurant, when try to Level 4 or 5 !
I had "Soup curry with chicken leg quarters"(骨チキンカリー) that is typical food in the shop.
"Soup curry with chicken leg quarters" include chicken leg quarters, many vegetables and rice.

930Yen.





Evaluation:
☆☆☆☆-

My Impressions:
   Taste:☆☆☆--
   Voume:☆☆☆☆-
   Performance:☆☆☆☆☆

Descent point:
Nohting !
If I had to choose, I should have taken upper hot level...


Sandwich House, in Shin-Chitose Air terminal.

"Sandwich House Gourmet"
I bought sandwich is "Roast beef, vegetables and cheese". This is good aperitif sandwich with wine.





Evaluation:
☆☆☆?-

My Impressions:
   Taste:☆☆☆--
   Voume:☆☆☆--
   Performance:☆☆☆☆-

Descent point:
I like flavor is more a little spicy.


Air Terminal Hotel, in CTS (3F CTS BLD,New Chitose Airport,Bibi,Chitose city, Hokkaido)

Do you love plane?

I stayed runway side room then I saw fronting of boarding bridge and plane. In the night, the lighting of runway was very amazing view.



Guests are able to use hot spring facilities in the airport(CTS 新千歳空港温泉). When you use hot spring, you exchange room key to using ticket. That isn't limit of numbers, for examples you can use night and morning. But! hot spring place locate out of hotel's area that is the airport facilities, and when your traveling don't forget dress.
In the hot spring place rent you free of charge Yukata or Jinbei(Japanese relaxed ware) and you can use relaxation room(The place has lady's room).
You'd check present time in the hot spring place, this airport has many restaurant bat some shop is early closing against showing opening time. Some shops closing start 19:30, food court shop's showing opening time is 10:00-2030 but closing start is around 20:00 (cause of sold out?). You are careful present time that isn't Narita or Haneda... (Some restaurant are opening 22:00 in CTS.)
To take matters worse, the airport shutout 23:00. If you relaxed too hot spring, when you should walk to hotels's entry via outside airport facilities.

And more one, card lounge don't locate inside the restricted area, so I can't experience this airport card lounge.


Saturday, October 8, 2016

Train drinking! Hakodate --> Shin Chitose international air port(CTS).

My traveling is Hakodate for Shin Chitose international air port(CTS) by express train Super Hokuto. Traveling duration is around three hour half minute.
Let me enjoy traveling and drinking !   #Trainbeer

Express Super-Hokuto and Hokuto are different train cars. I recommend to choice Super-Hokuto and reservation seat. Because, between Hakodate-Sapporo section is may congestion suddenly.



Let me drink!

Ika Jaga:
  Whole squid was stuffed potato.
Zangi kusi:
  Zangi is flied chicken Hokkaido style.
Nikuman:
  Limited Hokkaido flavor.
Sapporo Classic:
  Limited Hokkaido.
Haodate wine:
  Hakodate local wine.


Soft server ice cream Kikuchi in Hakodate.

Kikuchi is a small caffe shop, but this shop's soft served ice cream is excellent.

Flavors:
  Vanilla 260Yen
  Mocha 260Yen
  Mix(Vanilla+Mocha) 260Yen



Evaluation:
☆☆☆☆☆

My Impressions:
   Taste:☆☆☆☆☆
   Voume:☆☆☆☆☆
   Performance:☆☆☆☆☆

Descent point:
Nohting !
If I had to choose, the shop is small. If you are big group, when you can't seat all members.
But, you buy cheap by outside counter and eat at road are no problem.


Running in Hakodate morning. Take-2

I ran along shoreline yesterday, so today, I'm going to run around Goryokaku(五稜郭).
At the place, some runners already jog along Goryokaku moat road.

Goryokaku tower hight is 107m that visible even from distance.

Gryokaku moat circumference is 1.8Km.

Goryokaku shape is five pointed star.

I recommend to bring jogging equipments, when you visit Hakodate.
By the way, Season of Sakura in this reasion is early May. 


Running in Hakodate morning.

The weather was good, and it was comfortable to run along an early-morning shoreline of Hakodate.

Running start is 6:00 AM. Breeze is chilly.


The fishing port locate at the foot of Mt. Hakodate.


I return at the starting location and can see Mt. Hakodate in the distant.


Running Map.



Grilled Mutton Pot restaurant in Hakodate.

The dish is grilled mutton and vegetables called Jingisukan-Nabe (ジンギスカン鍋). I bought Ganguro-Set and mutton loin, and beers.

Cover charge and beer.


Ganguro combo include mutton, vegetables and rice.


Mutton loin.


Map.

Evaluation:
☆☆?--

My Impressions:
   Taste:☆☆☆--
   Voume:☆☆---
   Performance:☆☆---

Descent point:
I feel the meat is small each a dish, but good taste.


French restaurant Perry's bar in Hakodate.

We had lunch at Perry's bar that is a small Freanch restaurant at Hakodate Hokkaido Japan.
Hakodate locate south Hokkaido Japan, so there are many shops of the seasning that is thick because  there is a cold district.
However, this shop sauce is thin and using Japanese style flavor. In addition, we had ate dishes are using ingredients lavished with local products.

Appetizer.


Soup.


Steak.


Dessert.


Map

Evaluation:
☆☆☆☆-

My Impressions:
   Taste:☆☆☆☆?
   Voume:☆☆☆☆-
   Performance:☆☆☆--

Descent point:
I feel good restaurant except a little expensive.


Wednesday, September 21, 2016

Restraurant L'appetit, Hokodate

A restaurant in Hakodate that open to 23:00(Last call 22:00). If you arrived Hakodate at night when you can eat dinner.
This restaurant is thick sause and substantialicious foods, so fit in winter dinner.


Hamburg steak combo. 1,100Yen


Stroganoff pasta.



Evaluation:
☆☆☆--

My Impressions:
   Taste:☆☆☆--
   Voume:☆☆☆☆-
   Performance:☆☆---

Descent point:
So,  I feel it's a little expensive...but, hamburg is big.


Ramen shop Menzou-Sasanamiya in Hakodate

This ramen shop has two style ramen, one is thin flavor soup(あっさり), other is thick flavor soup(こってり).
I bought miso flavoe soup with grilled entrails(Hormon-Yaki) it's thick flavor(こってり) menu cause of visited in winter.





Evaluation:
☆☆☆?-

My Impressions:
   Taste:☆☆☆--
   Voume:☆☆☆☆-
   Performance:☆☆☆--

Descent point:
Not in particular.


Monday, September 19, 2016

Tadokoroshouten(田所商店) : Ramen

I visited a ramen shop "Tadokoroshouten" in Funabashi. That ramen shop is specialty of Miso flavor ramen.
We are eating are Hokkaido style miso flavor soup with seared Char siu and Shinshu style miso flavor soup with seared Char siu.


Hokkaido style soup is thick. 980Yen.


Shinshu style soup is salty. 980Yen.
They are both good Char siu.


Evaluation:
☆☆☆--

My Impressions:
   Taste:☆☆☆--
   Voume:☆☆☆☆-
   Performance:☆☆---

Descent point:
So,  I feel it's a little expensive...


Thursday, September 15, 2016

Sushi to go, Hokushin Funabashi branch

HOKUSHIN is a fish shop Funabashi branch located in the Tobu Department Store Funabashi.
Today, I bought Sushi to go.


My Evaluation:
☆☆☆?-



My Impressions:
Sushi-Neta:
   Variety:☆☆☆☆-
      Tuna, Yellowtail, Salmon, Squid, Shrimp, Mackerel, Raw shrimp, Salmon roe, Sea urchin, Sea eel, Rolled omelet
   Freshness:☆☆---

In detail.
   1,480Yen (including TAX)
   I visited shop around 19:15, but they give me 500Yen.

Descent point:
Sushi has subtle smell fishy. Did it a few hour passed from making? (Because they give deal.)

Wednesday, August 24, 2016

Linux IPC, Inet domain socket.

Linux IPC Internet domain of socket can communicate inter process/thread exchanging message on individually CPU(PC).
I made two examples, one is server socket program, other is client socket program on network.

inet-dimain-server.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>

// Make server socket.
//
int makeServer(int portNo) {

  int                sfd;
  int                ret;
  struct sockaddr_in serv;

  // Create server socket.
  if((sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    perror("ERROR:Server Socket()");
    return -1;
  }

  // Bind socket
  memset(&serv, 0, sizeof(struct sockaddr_in));
  serv.sin_family = AF_INET;
  serv.sin_addr.s_addr = htonl(INADDR_ANY);
  serv.sin_port = htons(portNo);
  if ((ret = bind(sfd,
                  (const struct sockaddr *)&serv,
                  sizeof(struct sockaddr_in))) < 0) {
    perror("ERROR:Server bind()");
    return -1;
  }

  // Listen, prepair for accept()
  if((ret = listen(sfd, 10)) < 0) {
    perror("ERROR:Server listen()");
    return -1;
  }

  return sfd;
}
// Make data socket for client.
//
int acceptClient(int sfd) {

  int dfd;

  if((dfd = accept(sfd, NULL, NULL)) < 0) {
    perror("ERROR:Server accept()");
    return -1;
  }

  return dfd;
}

// This main()
//
int main(int argc, char** argv) {

  int  sfd, dfd;
  int  portNo;
  int  ret;
  char buf[256];

  // Check running argument.
  if(argc < 2) {
    printf("inet-domain-server port-No.\n");
    return -1;
  }
  portNo = atoi(argv[1]);

  if((sfd = makeServer(portNo)) < 0) {
    return -1;
  }

  if((dfd = acceptClient(sfd)) < 0) {
    close(sfd);    // Close server socket.
    return -1;
  }

  // Main loop
  while(1) {
    if((ret = read(dfd, buf, sizeof(buf))) < 0) {
      perror("ERROR:Data read()");
      return -1;
    }

    printf("%s", buf);

    if(strncmp(buf, "END", 3) == 0) {
      printf("Received END\n");
      break;
    }

    // Send to client "NeXT".
    if((ret = write(dfd, "NeXT", 4)) < 0) {
      perror("ERROR:Data write()");
      return -1;
    }
  }

  // Send "END" for client.
  write(dfd, "END", 3);

  // Close data socket.
  close(dfd);

  // Close server socket.
  close(sfd);

  return 0;
}


"unix-domain-server" functions.
It needs one arguments, port-number.
   1. Create server side accepting socket.
   2. It wait to connect from client.
   3. Client data receive and server data send to client.
   4. If received data is "END" then send "END" and socket close.

inet-domain-client.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

#define HOST_ADDR "192.168.1.16"

int main(int argc, char** argv) {

  int                dfd;
  int                portNo;
  int                ret;
  struct sockaddr_in serv;
  struct hostent*    servAddr;
  char               buf[256];
  char               rcv[256];

  // Check running argument.
  if(argc < 3) {
    printf("inet-domain-client server-address port-No.\n");
    return -1;
  }
  portNo = atoi(argv[2]);

  // Create socket
  if((dfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    perror("ERROR:Client socket()");
    return -1;
  }

  // Connect server
  memset(&serv, 0, sizeof(struct sockaddr_in));
  serv.sin_family = AF_INET;
  serv.sin_port = htons(portNo);
  if((servAddr = gethostbyname(argv[1])) == NULL) {
    perror("ERROR:Client gethostbyname()");
    return -1;
  }
  bcopy((char*)servAddr->h_addr,
        (char*)&serv.sin_addr.s_addr,
        servAddr->h_length);

  if((ret = connect(dfd,
                    (const struct sockaddr*)&serv,
                    sizeof(struct sockaddr))) < 0) {
    perror("ERROR:Client connect()");
    return -1;
  }

  while(1) {
    // User input to send data.
    printf("#");
    memset(buf, 0, sizeof(buf));
    fflush(stdin);
    fgets(buf, 256, stdin);

    // Send to server.
    if((ret = write(dfd, buf, strlen(buf) + 1)) < 0) {
      perror("ERROR:Client read()");
      close(dfd);
      return -1;
    }

    // Reveive data from server.
    memset(rcv, 0, sizeof(rcv));
    if((ret = read(dfd, rcv, sizeof(rcv) - 1)) < 0) {
        perror("ERROR:Client read()");
        close(dfd);
        return -1;
    }
    printf("%s", rcv);

    if(strncmp(rcv, "END", 3) == 0) {
      printf("\nReceived END\n");
      break;
    }
  }

  // Close data socket.
  close(dfd);

  return 0;
}



"unix-domain-server" functions.
It needs two arguments, Server-Address(or name) and port-number.
   1. Create client side socket and connect to server.
        This program require tow argument for creation a socket, server-address and port-number.
   2. It wait to key input from user.
   3. Inputed data send to server via socket and receive server answer.
   4. If received data is "END" then socket close.

Ex. program execution.
      First, server run a terminal.
      # ./inet-domain-server 9999       ---> "9999" is example.

      Then, client run other terminal.
      # ./inet-domain-client 192.168.1.10 9999
               ---> "192.168.1.10" is example server address.
               ---> "9999" is same server made socket port number.

Good luck and enjoy your programing!


Monday, August 22, 2016

Linux IPC, Unix domain socket.

Linux IPC Unix domain of socket is inter process/thread exchanging message as you choose.
I made two examples, one is server socket program, other is client socket program.

unix-dimain-server.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>

// Make server socket.
//
int makeServer(char* sockName) {

  int                sfd;
  int                ret;
  struct sockaddr_un name;

  // Unlink, last running remove the socket.
  unlink(sockName);

  // Create server socket.
  if((sfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
    perror("ERROR:Server Socket()");
    return -1;
  }

  // Bind socket
  memset(&name, 0, sizeof(struct sockaddr_un));
  name.sun_family = AF_UNIX;
  strncpy(name.sun_path, sockName, sizeof(name.sun_path) - 1);
  if ((ret = bind(sfd,
                  (const struct sockaddr *)&name,
                  sizeof(struct sockaddr_un) - 1)) < 0) {
    perror("ERROR:Server bind()");
    return -1;
  }

  // Listen, prepair for accept()
  if((ret = listen(sfd, 10)) < 0) {
    perror("ERROR:Server listen()");
    return -1;
  }

  return sfd;
}
// Make data socket for client.
//
int acceptClient(int sfd) {

  int dfd;

  if((dfd = accept(sfd, NULL, NULL)) < 0) {
    perror("ERROR:Server accept()");
    return -1;
  }

  return dfd;
}

// This main()
//
int main(int argc, char** argv) {

  int  sfd, dfd;
  int  ret;
  char buf[256];

  if((sfd = makeServer(argv[1])) < 0) {
    return -1;
  }

  if((dfd = acceptClient(sfd)) < 0) {
    close(sfd);    // Close server socket.
    return -1;
  }

  // Main loop
  while(1) {
    if((ret = read(dfd, buf, sizeof(buf))) < 0) {
      perror("ERROR:Data read()");
      return -1;
    }

    printf("%s", buf);

    if(strncmp(buf, "END", 3) == 0) {
      printf("Received END\n");
      break;
    }

    // Send to client "NeXT".
    if((ret = write(dfd, "NeXT", 4)) < 0) {
      perror("ERROR:Data write()");
      return -1;
    }
  }

  // Send "END" for client.
  write(dfd, "END", 3);

  // Close data socket.
  close(dfd);

  // Close server socket.
  close(sfd);

  return 0;
}


"unix-domain-server" functions.
   1. Create server side accepting socket.
        This program required an argument "socket name".
   2. It wait to connect from client.
   3. Client data receive and server data send to client.
   4. If received data is "END" then send "END" and socket close.

unix-domain-client.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>

#define HOST_ADDR "192.168.1.16"
int main(int argc, char** argv) { int dfd; int ret; struct sockaddr_un name; char buf[256]; char rcv[256]; // Create socket if((dfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { perror("ERROR:Client socket()"); return -1; } // Connect server memset(&name, 0, sizeof(struct sockaddr_un)); name.sun_family = AF_UNIX; strncpy(name.sun_path, argv[1], sizeof(name.sun_path) - 1); if((ret = connect(dfd, (const struct sockaddr*)&name, sizeof(struct sockaddr_un) - 1)) < 0) { perror("ERROR:Client connect()"); return -1; } while(1) { // User input to send data. printf("#"); memset(buf, 0, sizeof(buf)); fflush(stdin); fgets(buf, 256, stdin); // Send to server. if((ret = write(dfd, buf, strlen(buf) + 1)) < 0) { perror("ERROR:Client read()"); close(dfd); return -1; } // Reveive data from server. memset(rcv, 0, sizeof(rcv)); if((ret = read(dfd, rcv, sizeof(rcv) - 1)) < 0) { perror("ERROR:Client read()"); close(dfd); return -1; } printf("%s", rcv); if(strncmp(rcv, "END", 3) == 0) { printf("\nReceived END\n"); break; } } // Close data socket. close(dfd); return 0; }


"unix-domain-server" functions.
   1. Create client side socket and connect to server.
        This program required an argument "socket name".
   2. It wait to key input from user.
   3. Inputed data send to server via socket and receive server answer.
   4. If received data is "END" then socket close.

*Server/Client need a argument-1 is socket name.
   Ex. program execution.
      First, server run terminal.
      # touch hogehoge                   --> hogehoge is socket name
      # ./unix-domain-server ./hogeoge

      Then, client run other terminal.
      # ./unix-domain-client ./hogehoge

Good luck and enjoy your programing!


Monday, August 1, 2016

Costoco SUSHI, Combo plate 48CT for family.

The Costco fish counter deal SUSHI in their warehouse. Today, I  bought  SuSHI combo plate 48CT.
My Evaluation:
☆☆?--



My Impressions:
Sushi-Neta, fish thick cutting filett are good fresh, tasty and no smell fishy.
This "Sushi combo" is ate easily for kids and womens prefer not have.

In detail.
   Tuna, Octpous,Scallop, Yellowtail, Squid and boiled Shrimp is 5CT each.
   Salmon is 10CT.
   Rolled Negitoro is 4CT.
   Rolled omelet is 4CT. Total 48CT.

   2,480Yen (including TAX)

Descent point:
Shari(rice hand-formed) is not tasty it was made by robot hands. He was dull that time.

Thursday, July 28, 2016

My favorite Mentaiko.

Do you know "Mentaiko"?


I love putting some Mentaiko on freshly steamed rice and eating them together.

I like best Mentaiko shop is "Fukuya":ふくや in Nakasu Hakata Fukuoka city Fukuoka prefecture Japan.

Costoco SUSHI, tuna only packed.

The Costco fish counter deal SUSHI in their warehouse. I visited Costco Wholesale New town Chiba Japan.

My Evaluation:
☆☆☆--


My Impressions:
Sushi-Neta, fish thick cutting filett are good fresh, tasty and no smell fishy, and more fillet has not been frozen.
This "Maguro Sushi" is ate easily for kids and womens prefer not have.

I bought "Maguro Sushi":「鮪寿司」:Tuna only, it package included 8 tuna-nigiris and 8 tuna-roll.
   1,580Yen (including TAX)

Descent point:
It's neither good nor bad.


Monday, July 25, 2016

Buckwheat noodle with deep fried chicken :A stand-up eating soba noodle shop

This stand-up eating soba noodle shop location is the JR Abiko station yard.

The shop name is "Yayoiken":弥生軒 that has a item "kara-age soba":唐揚げそば:Buckwheat noodle with deep fried chicken.


It's deep fried chicken put on soba, but soba noodle is not tasty.
This station is located near Narita station using Nalita line for Abiko, if you have a chance.


Tuesday, July 19, 2016

The rainy season was over Tokyo Japan.

The rainy season at beginning summer is called "Tuyu" in Japan.It has rainy and humid during the period.

2016year state of Tuyu.
Okinawa, Amami: begin 16 May, finish 18 June.
Kyushu, Shikoku, Chugoku, Kinki, Tokai: begin 4 June, finish 18 July.
Kanto: begin 5 June, finish ???
Hokuriku, Tohoku: begin 13 June, finish ???

Many Japanese don't really like Tuyu.


Friday, July 15, 2016

Built a new bike.

A bike was given to me by acquaintance that the bike was built around twenty five yeas ago.
This bike was built parts overview.
  + Frame : Tange champion
  +Deraler : Campagnolo nuovo record
  +Clank set : Shimano
  +Wheels F/R : Tubular tire wheels
  +Breaks F/R : Shimano

I feel, this bike ex-owner would have used to touring.
I consider, the bike restructure using for my daily workout in my town.
So, I combine that bike and other bike parts.

I change and replace below parts.
   + Remain of the original.
      --> Frame.
      --> Clank set.
      --> Break.
   + Tires and wheels change to clincher from tubular.
      --> Aluminum clincher wheels.(other bike's)
      --> Tires are Continental's ultra sport yellow.(New)
   + Rear sprocket change to single from multi.
      --> Single sprocket.(Other bike's)
   + Nuvo record groupset replace.
      --> Shimano chain tensioner ALFINE CT-S500.(New)
      --> Using chain tensioner is to be able to change front sprockets.
   + Put on, bike bell and light.
      --> These parts was bought 100Yen shop by me.(New)

Replaced Campagnolo groupset is in safekeeping for my future bike.



Oh! I forgot bike stand!!
(This picture bike was leaned yellow pole.)


Uokou(魚耕), fish shop Sushi

The Uokou:魚耕 deal in SUSHI that is the fish shop in Funabasi Chiba Japan.
This shop locate "Shapo" shopping mall of JR Funabashi station.



My Evaluation:
☆☆☆--


Impressions:
Sushi-Neta, fish filett are good fresh and tasty.
I bought "Nigiri":「にぎり」, but I didn't buy more one upper grade combo that was sold out!
   "Nigiri"  1,389YEN
This shop combo include 20 pieces. Will you full?

The shop open for 21:00, but sushi sold out around 19:30.
I visit the shop about 19:15. The shop hardly has SUSHI stocks, but other items remain sale ex. Sashimi, Saku, hole fish and Himono.
So I bought last minute just before sold out the sush, and they give me deal.
   "Osusume Nigiri"  1,388YEN  ---> 1000YEN(Including TAX!)

Descent point:
The combo was limited Sushi-Neta  various.


The credit card is not usable in the convenience store of the JR Station.

JR(Japan Railways) stations yard are located convenience store "NewDays", but those store is not able to using credit card.
Anyway, you can use convenience store in downtown If you want to use credit cards.

I don't really like use real money in convenience store, because my purse becomes tight by many coins.

Have a good trip in Japan!


Friday, July 1, 2016

Uotsuru(魚つる), fish shop Sushi

the Uoturu:魚つる deal in SUSHI that is the fish shop in Fujisawa Kanagawa Japan.
They have a good reputation in local area.


My Evaluation:
☆☆☆--


Impressions:
Sushi-Neta, fish filett are good fresh and very tasty.
I bought "Osusume Nigiri":「おすすめにぎり」:recommendation combo it has various fish in a package. That recommends for fish lovers.
   "Osusume Nigiri"  1,343YEN
Something else, Maguro:Tuna only, Chirashi ...

The shop open for 19:00, but sushi sold out around 18:00.
I visit the shop about 17:30, when they started closing preparation and give me deal.
   "Osusume Nigiri"  1,343YEN  ---> 800YEN

Descent point:
Sushi has subtle smell fishy. Did it a few hour passed from making? (Because they give deal.)


Monday, June 6, 2016

Making, Petal Lens Hood.

I have a camera SONY DSC-HX200v that hasn't any lens hoods, but I feel block the sun light when taking pictures at ground daytime.
So, I try making the Petal Lens Hood.

The steps show to making Petal Lens Hood.
   1. Measure AOV.
   2. Measure camera lens part size.
   3. Make 3D objects data.
   4. Printing!
To make way show the details each steps as follows.

1. Measure AOV
"AOV" stands for Angle Of View, each camera has individual AOV.
I can measure AOV in simple method. The simple method needs a graph paper(1mm size), a tripod. Graph paper spreads your desk, camera attached tripod brings your desk side. Camera lens turn desk surface, so can take graph paper with horizontal.
This method find extent image size(X, Y) from took pictures graph paper grid number, and took pictures differ several height.
In taking pictures,
Keep zoom position, Keep tripod positions exempt height position.

I take pictures in three height positions from the desk surface.
   10mm from surface. X=40.5, Y=30.5
   30mm from surface. X=65.0, Y=49.0
   60mm from surface. X=103.5, Y=79.0
Those data use in third step.


2. Measure size camera lens part.
Fitting petal hood, lens outside diameter measures in accurate, but actual printing size may need to adjust from your 3D printer or slicing programs ability.
I try, it was made ABS material, that is apt to shrinking to cool. I expand 0.25mm size of lens fitting diameter.

3. Make 3D objects data.(With 123D DESIGN)
This petal lens hood was made three part objects and shaped from an AOV object.
Fitting part, step2 was measure size of lens cylinder.
Shape petal hood, as you like its diameter size of cylinder, making detailedly shpae petal later.
Other part is joint two part shape taper.
Besides, an AOV object need making petal shape. AOV object is made from step 1 three X/Y data. Using Sketch draw real size three rectangles and place sketch objects actual relative position(under 60mm, middle 30mm, top 10mm image rectangles). Selected three sketch objects and use Loft, a trapezium pyramid appear there. It is DSC-HX200v actual AOV. I take margin with AOV, use Scale expand X and Y times 1.1, doesn't Z scale changing.
Petal base make a cylinder style object. Cover the cylinder with a pyramid top, and point of cylinder cut into pyramid(move Z down).
Using Subtract subtract a pyramid object from a cylinder object.
Don't you think petal shape?
Petal's edges and corners chamfer using Fillet.
Finishing, attach petal part on taper part, these on fitting part

4. Printing!
Do your best and leave the rest to Providence.

Result!

Documents. (At a later date)
   123d design
   STL


Tuesday, May 17, 2016

Making, Cat Ornament.

I try making a cat ornament.
The cat is designed a ornament that sits on the edge.

Try 1.
At first, the cat design using 123d design then make STL data.
Making STL data converts slicing g-code by Slic3r.
But Slic3r made superfluous data in the g-code. It isn't support parts.

Try 2.
Slic3r can't make support part in successfully by Slic3r. I have no choice but split data at legs. Legs designed to fit into mold shape.
A part of legs is satisfactory result, but bust partially is made superfluous data in g-code.

Try 3.
I tamper with objects data, so change size, angle, position and cat's face... Data making and printing tried several running.
At last, I can make successfully one.
If only printing bust, it's shape looks like SEIZA(formal style sitting in Japan).


The cat sits on edge.
   123d design data
   STL data

Conclusion.
Slic3r fail making data that was made STL data conditions, so slight changing oject construct objects, for example objects size, angle and position.


Tuesday, May 10, 2016

Try! ABS material 3D printing.

Scoovo C170 specs is not formally supported ABS material.
... But I try printing 3D objects by ABS material.

I got ABS material at Amazon.
   3Dcreators sells materials in Amazon.

Try 1.
   I try same test bed condition that face is masking tape only.

   Result.
      Printed object don't stick on test bed.
      ABS material don't stick masking tape face.

   Measures.
      I use glue(borrow my son, he using school),
      it spread on masking tape face.
      An object stick on test bed steady.

Try 2.
   Slic3r don't change all  slicing parameters when PLA printed.

   Result.
      First layer fixed on test bet. (Try 1. successfully)
      Printed objects are apt to exfoliate between layers
      or exfoliated object cling around the print head.

   Measures.
      Melting temperature up to 230°C.
      (Temperature range, PLA 190-220°C, ABS 200-250°C)
      Layer height down to 0.05mm from 0.1mm.
      (Maker specs says minimum thin is 0.1mm.)
      And the settings don't use "Easy mode", using to "Advance mode".

      Advanced mode can adjust detail of objects making parameters.
         + First layer settings.
            + Temperature 230°C.
            + Height is 0.35mm
         + Other layer
            + Temperature 230°C.
            + Height is 0.05mm

Try 3.
   I'll completely finish an object making!

   Result.
      I decrease layer height by Try 2, so don't cover top face. (;_;)

   Measures.
      Solid layers increase number to five which are bottom and top face layers.

      Added change parameters.
         + Solid layers
            + Top 5
            + Bottom 5

Sample an Object. (Three pointed star)
This three pointed start is made two pats. It only fit isn't use glue.
Navy blue part is ABS material.
White is PLA material.

Saturday, May 7, 2016

Why don't use CPU over 44% in Windows 10 ?

Using in Windows 10 increase CPU percentage working after a while. Although I uninstall sykeype programs. However CPU consumption percentage stick 44% when internet surfing use browser for a while. In addition, doesn't CPU consumption decrease I quit browser. And more, I'm bothered cooling fan noise!
Why?

 Is This condition only Windows 10?

Search Result:
The reason for CPU consumption problem is 32 bit emulator in Windows 10 64 bit. The emulator is idiot.
And necessary applications use little 32 bit programs in the 64 bit environment.
Browsers Google Chrome and FireFox, download not specific 64 bit, or downloading 32 bit automatically.  (`=')

I uninstall 32 bit Chrome and FireFox and install 64 bit them, so my PC work normal after rebooting.

More information:
Google Drive for PC.
   It is only deployed 32 bit program.  I was remove one.

Apache OpenOffice for Windows.
   It is only deployed 32 bit program.  Apache announces done.
   give up. I reboot my PC sometimes.

Caution, 64 bit environment is mixed 32 bit programs!


Friday, May 6, 2016

Installed Window 10 adjust my favorite UI.

I upgraded Windows 10.
However I dislike Windows 10's UI.


I like Windows 10 rather than Windows8. But I'm annoyed  windows menu right side shown images. Those images are said "Tile". Microsoft like "Tile" from Wondows 1.0.
I try to remove tiles! WinKey → Settings → Personalization → Start, set "OFF" "Show more tiles", and displayed tile set "Unpin from start" one by one.

Task bar fix on upper, icon is small. Task bar transparent adjust off that Settings → Personalization → Colours →"Make Start, taskbar and Action Center transparent".
I can't adjust color minutely, it's OK for now.

Login(Sign in) screen.
I dislike displayed user name on sign in screen. How don't sign in screen display user name?
... I research...
I find a way, as usual, changing handle "regedit.exe".
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\System
dontdisplaylastusername <-- 1
Sign in screen displayed "Other user", so input require user name and pass word.

And more, How do Administrator define? I input Administrator at user name, but can't sign in. Next, command prompt run as administrator, and user confirm by net command. Although Windows Home Edition has not means setting administrator user, net command can set pass word at administrator.


So this PC can sign in via Administrator user.

Skype disable.
Windows 10 increase CPU percentage working after a while. Why does process consume CPU power? I showed Task Manager and seek CPU consumption process. I find "Skypehost,exe". Why doing? I don't install Skype.
I google, so it installed default Windows 10 and can uninstall them.
   ---->Original
I try below Steps:
   + WinKey + I, shoe Settings
   + Select "System"
   + Select "Apps and Features"
   + Uninstall "Messaging", "Skype Video App" and "Skype App"

I'd rather not default installing unnecessary programs, Microsoft.

Change lock screen
I dislike beach cave picture on "System Lock Screen"
Lock screen change by WinKey+I → Personalization → Lock Screen, but it's after sign in lock screen. I want to change lock screen is before sign in!
In case of do not adjust normal way with Windows, when it use "regedit.exe" as usual.

At first, regedit.exe run. WinKey+R, input "rededit".

Second, Make a new key.
Select "HKEY_LOCAL_MACHINE\SOFTWARE\Plicies\Microsoft\Windows\", and right click show menu, so select "New" --> "Key".
New key name "Personalization"

Next, Make a new value.
Right click made Personalization key, select menu "String Value".
Make new registry and name "LockScreenImage"
This registry set your favorite a picture full path.
Ex.



Incidentally Personalization NoLickScreen(DWORD)=1 is not display lock screen.
I don't try many picture size and formats(Ex. is 1920x1080 jpeg).



THIS PAGE IS NO WARRANTY.
I recommend save windows registry before working.
I hope you get Happy!