9 years, 5 months ago.

how to dump the c++ code on LXP1768 ?

sir i written a C++ code for some application and code is working on C++ compiler(GNU),now i want to implement the same code on LXP1768(my code includes file reading operations and 10 arrays of size 1024 with 16 bit ) please help me

starting lines in my C++ code

  1. include <iostream>
  2. include <string>
  3. include <fstream>
  4. include <bitset>

using namespace std; int main() { signed int EcgArray1[4095]; int i=0; fstream textfile; textfile.open("ECG_deci_4096.txt"); while (! textfile.eof()) {textfile >> EcgArray1[i]; i++; } textfile.close(); cout << "Displaying Array(0thDWT)..." << endl; to display 8192 samples for(int i =0; i<10; i++) {cout << "EcgArray1[" << i << "] => " << EcgArray1[i] << endl; } DWT 1st stage signed int EcgArray2[2047]; for (int i=0; i<2048; ++i) {EcgArray2[i]=EcgArray1[(2*i)]+EcgArray1[(2*i+1)]; } cout << "Displaying Array(1stDWT)..." << endl; for(int i =0; i<10; i++) {cout << "EcgArray2[" << i << "] => " << EcgArray2[i] << endl; }

Please edit the question o put <<code>> before your code and <</code>> after it so that the formatting isn't lost.

posted by Andy A 19 Dec 2014

2 Answers

9 years, 5 months ago.

You're going to be very tight on RAM but 20k of storage is possible. If you don't need Ethernet or CAN you can access some extra ram. See http://developer.mbed.org/forum/mbed/topic/2203/ for details of how to do this.

Use c style file IO rather than c++ streams and use either localFileSystem or SDFileSystem to store your files you need to access.

Similarly use printf rather than c++ streams for IO to the serial port.

you'll need <stdio> but try to do without the other standard libraries if you can.

Accepted Answer
9 years, 5 months ago.

The best way to proceed is to put your code onto Mbed first. Take a look at other code examples to see how the Mbed IDE works. Try to build your code and see what errors you get then you can change the code to build.

If you then have an issue you can not resolve post the code as Andy says where it easier to see the problem.

I have done this in the past with Arduino code.