Read Data from ARM Cortex-M through serial port

Hello all,
I am using OpenWrt 19.07 on Omega 2s pro.
I want to read the data from ARM Cortex-M through serial Port.

The set is like

  • lan cable is connected to omega
  • openwrt is running on Omega
  • ARM is connected to the omega through serial port.

I want to read the data coming from ARM and push it to server .
I am thinking to write a python script for the above job.

How can I read the data through serial port , what all sorts needs to be followed ?

Thanks in advance

You don't need a Python for that... all you need is a good bash scripting

Here is how to read something from serial:
cat /dev/ttyS0
cat < /dev/ttyS0
socat stdio /dev/ttyS0
or with hex dump:
od -x < /dev/ttyS0

Once you read it then you can push it to server using famous "curl" OR using nc:

As you can see there is no python involvement in this. Just shell scripting.