關於我自己

2020年3月13日 星期五

RTOS

1.freertos
https://www.freertos.org/

2.FreeRTOS Real Time Kernel (RTOS)
https://sourceforge.net/projects/freertos/postdownload

1.

2.

3.

4.

5.

6.

7.

8.


BeagleBone Black Uboot (AM3359_BeagleBone_GCC)



OS:Ubuntu 14

sudo apt install git

git clone https://github.com/henfos/BBBFreeRTOS.git

sudo rm /var/lib/dpkg/lock

sudo rm /var/lib/apt/lists/lock

sudo rm /var/cache/apt/archives/lock

cd BBBFreeRTOS/Demo/AM3359_BeagleBone_GCC

https://launchpad.net/gcc-arm-embedded/+download

chmod 777 gcc-arm-none-eabi-5-4.2016q3-20160926-linux.tar.bz2

tar -xf gcc-arm-none-eabi-5-4.2016q3-20160926-linux.tar.bz2

arm-none-eabi-gcc -v

#include <stdint.h>

CC=arm-none-eabi-gcc
OBJCOPY=arm-none-eabi-objcopy
ARCH=arm-none-eabi-ar

make

1.
 2.
 3.
 4.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.

BeagleBone Black Uboot (am335x_evm_defconfig)





Boot control:
The normal sequence is (S2 button not pushed):
  • MC1 (eMMC on-board flash), MMC0 (SD card), UART0, USB0
S2 button pushed:
  •  SPI0, MMC0 (SD card), USB0, UART0

OS:Ubuntu 18

指令:


sudo apt-get update


sudo apt-get install gcc-arm-linux-gnueabi

sudo apt-get install build-essential

sudo apt-get install bison

sudo apt-get install flex


sudo apt install git

sudo apt install make

git clone git://git.denx.de/u-boot.git u-boot

cd u-boot

alias armmake='make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- '

armmake  distclean

armmake am335x_evm_defconfig

armmake

1.


 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.



2020年3月2日 星期一

Swagger-ui-express

    作業環境:

    express 4.16.0

    swagger-ui-express 3.0.10

    swagger-jsdoc 1.10.3

    指令:
==========================================
express
npm install
npm start
http://127.0.0.1:3000/
==========================================
npm install swagger-ui-express
npm install swagger-jsdoc
http://127.0.0.1:3000/api-docs/


1.執行結果



2.設定JSON格式

 3.編寫區域




GET & POST 部分 (users.js)
=================================

var express = require('express');
var router = express.Router();

/**
 * @swagger
 * /users:
 *   get:
 *     tags:
 *       - users
 *     description: Returns all users
 *     produces:
 *       - application/json
 *     responses:
 *       200:
 *         description: An array of users
 *         content:
 *          application/json:
 *            schema:
 *              type: array
 *              items:
 *                type: object
 *                properties:
 *                  id:
 *                    type: integer
 *                  name:
 *                    type: string 
 */
/* GET users listing. */
router.get('/', function(req, res, next) {
res.setHeader('Content-Type', 'application/json');
    res.end(JSON.stringify({ "id": 1,"name":"user1" }));
   //res.send('respond with a resource');
});

/**
 * @swagger
 * /users:
 *   post:
 *     tags:
 *       - users
 *     description: Creates a new user
 *     produces:
 *       - application/json
 *     parameters:
 *       - name: body
 *         in: body
 *         required: true
 *         schema:
 *           type: object
 *           required:
 *             - username
 *             - password
 *           properties:
 *             username:
 *               type: string
 *             password:
 *               type: password
 *           example: {
 *             "username": "UserName",
 *             "password": "UserPassword"
 *           }
 *     responses:
 *       200:
 *         description: An array of users
 *         content:
 *          application/json:
 *            schema:
 *              type: array
 *              items:
 *                type: object
 *                properties:
 *                  username:
 *                    type: string
 *                  name:
 *                    password: string 
 */
/* GET users listing. */
router.post('/', function(req, res, next) {
res.setHeader('Content-Type', 'application/json');
//req.body.username  req.body.password 
    res.end(JSON.stringify({ "username": req.body.username,"password":req.body.password }));
    //res.send('respond with a resource');
});

module.exports = router;

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

參考網址:

https://www.breakyizhan.com/swagger/2991.html

https://swagger.io/specification/