method to get output of itm.txt in a file?

173 Views Asked by At

all I am new to Embedded development. Currently, I am working on the discovery board using the discovery book. I have almost completed the book now I want to achieve more in this. What do I want to do? I recently worked on sensors, I got the reading from the sensors on the itmdump(itm.txt) file. Now I want this data to post on an (HTTP request). My plan??

  1. Write the data into a file.
  2. Get data from that file.
  3. Post data to the provided link.

I am working with a no_std environment and found nothing on how to output the data into a file directly or from itmdump to a file. This is my repo I want to write this hello discovery into a file. Can anyone please help me with how can I achieve this? and am I going right with the steps to achieve my task?

The no_std code:

#![no_main]
#![no_std]


use cortex_m_rt::entry;
use cortex_m::iprintln;
use panic_itm as _;
use stm32f3_discovery::stm32f3xx_hal::prelude::*;

#[entry()]
fn main() -> !{

    let peripherals = cortex_m::Peripherals::take().unwrap();
    let mut itm = peripherals.ITM;


    iprintln!(&mut itm.stim[0],"Hello Discovery!");

    loop {

    }
}
1

There are 1 best solutions below

1
On

You can't do this. Or at least not as an independent application.

You have a development environment which allows you to transmit sensor data over serial and write it to a file on your computer. (The itmdump you talked about)

However a microcontroller doesn't have a HDD or networking. You need to add the peripherals to communicate to the network and get the network stack to do HTTP. If you have those connected and communicating you can then transmit packets from your board directly to the network server.

itmdump only works because you have a PC with a protocol connected to do the writing to a local file