Help save net neutrality! Learn more.

float problem

Test User
  • Test User

    Test User - 2010-05-07


    I got the following error message

    …>sdcc -o noname.hex -mpic14 -p16f74 calc.o 
    message: using default linker script "…\16f74.lkr"
    error: no target memory available for section "code_fseq"
    warning: relocation of section "UDL_fs2ulong_0" failed, relocating to a shared memory location
    error: linker script has no definition that matches the type of section "UDL_fs2ulong_0"

    For this code.
    Replacing 'float' to 'unsigned char'  works

    #include "pic16f74.h"
    void _sdcc_gsinit_startup (void) {
        pagesel _main
        goto    _main
    void main(void)
        float a, b, op, res;
        TRISA = 0xFF;
        TRISB = 0xFF;
        TRISC = 0x00;
        while (1) {
         a = PORTB & 0x0F;
         b = (PORTB & 0xF0) >> 4;
         op = PORTA & 0x0F;
         if (op == 1)
          res = a+b;
         else if (op == 2)
          res = a-b;
         else if (op == 3)
          res = a/b;
          res = a*b;
         PORTC = res;


  • Raphael Neider

    Raphael Neider - 2010-05-11

    Your device has 4 KiB of code memory and only 2x96 (192) bytes of RAM. The linker tried to place some data from SDCC's floating point library - the fs2ulong conversion routine - in your RAM but failed. You are out of memory. You probably need to use a larger device to do floating point on. Sorry.

    Best regards


Log in to post a comment.