platformio / platform-nxplpc

NXP LPC: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/nxplpc
Apache License 2.0
9 stars 12 forks source link

LPC11U24: can print float values on terminal #7

Closed renanbmx123 closed 5 years ago

renanbmx123 commented 6 years ago

I working with LPC11U24 board with chip lpc11u24f/401, and im trying to see my float values in terminal but the value is empty even if i put a static value to print . i try use this command on platformio.ini build_flags = -Wl,-u,_printf_float,-u,_scanf_float, but linter says that region FLASH overflowed n bytes and ld return 1 exit status.

ivankravets commented 6 years ago

Have you resolved this issue?

renanbmx123 commented 6 years ago

No, im using online compiler for now.

renanbmx123 commented 6 years ago

Hello guys, i have download vscode to try code on platformio again. But i stuck on same problem, when i use this flags to see my float values they say tha same erro that i get when i use atom editor. Here is the message that i get from vscode "Error: The program size (33020 bytes) is greater than maximum allowed (32768 bytes)". Without this command the code have 20480 bytes and i can upload to my board. Its sems that flag add more then 1k bytes on my code.

Configuration: Arch linux

PlatformIO Version: Vscode + PlatformIO IDE 3.0 Core 3.5

The content of platformio.ini: [env:lpc11u24] platform = nxplpc board = lpc11u24 framework = mbed upload_port = /dev/ttyACM0 upload_protocol = cmsis-dap build_flags = -Wl,-u,_printf_float

My code:

include "mbed.h"

Serial pc(USBTX,USBRX); Serial gps(p9, p10);

void Init() { gps.baud(9600); pc.baud(9600);

}

void Gps_read(char *buffer) { char c,buff[200];

 if(gps.readable())
 { 
    if(gps.getc() == '$') 
    {
        for(int i = 0; i<sizeof(buff); i++)
        {
            c = gps.getc();
            if( c == '\r' )
                i = sizeof(buff);
            else
            {
                buff[i] = c;
            }
        }
    }
}
memcpy(buffer,buff,strlen(buff));

}

void parse(char cmd, float latitude, float longitude, float timefix, float speed, float altitude, char ns, char ew) {

char  tf, status,nss,eww;
int fq, nst, fix, date;                                     // fix quality, Number of satellites being tracked, 3D fix

// Global Positioning System Fix Data
if(strncmp(cmd,"$GPGGA", 6) == 0) 
{
    sscanf(cmd, "$GPGGA,%f,%f,%c,%f,%c,%d,%d,%*f,%f", timefix, latitude, *ns, longitude, &eww, &fq, &nst, altitude);
}

// Satellite status
if(strncmp(cmd,"$GPGSA", 6) == 0) 
{
    sscanf(cmd, "$GPGSA,%c,%d,%d", &tf, &fix, &nst);
}

// Geographic position, Latitude and Longitude
if(strncmp(cmd,"$GPGLL", 6) == 0) 
{
    sscanf(cmd, "$GPGLL,%f,%c,%f,%c,%f", latitude, *ns, longitude, &eww, timefix);
}

// Geographic position, Latitude and Longitude
if(strncmp(cmd,"$GPRMC", 6) == 0) 
{
    sscanf(cmd, "$GPRMC,%f,%c,%f,%c,%f,%c,%f,,%d", timefix, &status, latitude,*ns, longitude, &eww, speed, &date);
} 
*ew = eww;
//aux = 234.1;
//*latitude = aux;
//*longitude = 120.2;

//memcpy(longitude,&lon,sizeof(lon));

}

int main() {
Init(); char cDataBuffer[200], ns, ew; float lon, tfix, spd, alt, lat;

memset(cDataBuffer,0,200);

while(true) 
{
    Gps_read(cDataBuffer);
    parse(cDataBuffer,&lat,&lon,&tfix,&spd,&alt,&ns,&ew);
    //printf("%s\n",cDataBuffer);
    printf("lat:%f\n",lat);
    printf("lon:%f\n",lon);

    wait(1);
}   

}

ivankravets commented 6 years ago

Could you reproduce this issue with the latest release?

ivankravets commented 5 years ago

Please reopen if you still need help