2829 views|5 replies

2870

Posts

4

Resources
The OP
 

STM32MP157A-DK1 evaluation + GO language web service (5) [Copy link]

Now many embedded devices with network ports provide web-based configuration tools. I have recently been learning about the GO language, and some information says that the cross-platform characteristics of the GO language are very good and the performance is also very good. So I want to try to run GO programs on the development board to see if I can run GO programs.
This test uses golang version 1.13.5. The information says that only GO versions above 1.5 support cross-compilation. This point needs to be noted

package main

import (
     "fmt"
     "net/http"
)

func handler(w http.ResponseWriter, r *http.Request){
    fmt.Fprintf(w, "Hi, This is an example of http service in golang!")
}

func main() {
     http.HandleFunc("/", handler)
     http.ListenAndServe(":8080", nil) 
}


My GO environment has been tested, so I just wrote the code.
The compilation process
sets the environment:
set GOOS=linux
set GOARCH=arm
set GOARM=7
The environment parameters GOOS=linux specify the platform; GOARCH=arm specifies the CPU architecture; GOARM=7 specifies the ARM instruction set;
compile the program
go build helloweb.go

Upload the file scp
helloweb root@192.168.0.103:/usr/local.
Please replace it with the IP address of your machine.
The files transferred by scp on Windows machines do not have execution rights!

chmod +x helloweb


You can see the correct output page.
Unfortunately, the size of the program written in go is a bit large. Mine is about 6.15M. However, the functions and performance of programs written in go language are much better. And the functions can be very rich. The development efficiency is also relatively high. Go also supports the writing of dynamic libraries, and with C language, some more complex programs can be written.

This content is originally created by bigbat , a user of EEWORLD forum. If you want to reprint or use it for commercial purposes, you need to obtain the author's consent and indicate the source

This post is from stm32/stm8

Latest reply

GC will be a big problem in embedded environment   Details Published on 2020-4-13 18:40
 

661

Posts

18

Resources
2
 

I have a question, the Go language looks very similar to the C language.

This post is from stm32/stm8

Comments

The syntax of golang is not similar to that of C or even C++. It is a new language. It has the characteristics of a functional programming language and can also support interfaces and polymorphism.  Details Published on 2020-3-30 11:23
 
 

2870

Posts

4

Resources
3
 
Lambo posted on 2020-3-30 10:06 I have a question, this Go language looks very similar to C language

The syntax of golang is not similar to that of C or even C++. It is a new language. It has the characteristics of a functional programming language and can also support interfaces and polymorphism.

This post is from stm32/stm8
 
 

6069

Posts

4

Resources
4
 

Not bad. This board is BGA and the price is not cheap. So it is difficult to popularize. Let's see how ST promotes it later. It seems to be quite good to play with.

This post is from stm32/stm8

Comments

I heard that 70% of ST's revenue comes from retail investors, so it shouldn't be too expensive. And ST's chip information is relatively open, so I guess it's aimed at selling chips. It doesn't matter whether the board is expensive or not.  Details Published on 2020-4-8 12:34
 
 
 

2870

Posts

4

Resources
5
 
damiaa posted on 2020-4-8 10:56 Not bad. This board is BGA and the price is not cheap. So it is difficult to popularize. Let's see how ST promotes it later. It seems to be pretty good to play with.

I heard that 70% of ST's revenue comes from retail investors, so it shouldn't be too expensive. And ST's chip information is relatively open, so I guess it's aimed at selling chips. It doesn't matter whether the board is expensive or not.

This post is from stm32/stm8
 
 
 

855

Posts

5

Resources
6
 

GC will be a big problem in embedded environment

This post is from stm32/stm8
 
Personal signature作为一个菜逼,干货并没有多少。唯一会的就是水,所以回帖水分大。望见谅!
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list