Menu

#178 mul32

None
closed
padauk (1)
5
2024-05-26
2022-11-21
No

I got strange issue.
Following code:

  for(;;)
    for(uint16_t v=0; v<16; v++)    {
      int32_t tmp = v;
      tmp *= 3; // <- magic line, with power of 2 is fine
      tmp /= 123;
      printf("%lu\n", tmp );
    }

throw linking errors:

?ASlink-Warning-Invalid address for instruction for symbol  s_OSEG
         file              module            area              offset
  Refby  helloworld_pfs    helloworld        HEADER3                000000
  Defin  helloworld_pfs    helloworld        .  .ABS.               000105

?ASlink-Warning-Invalid address for instruction for symbol  l_DATA
         file              module            area              offset
  Refby  helloworld_pfs    helloworld        GSINIT                 00000A
  Defin  helloworld_pfs    helloworld        .  .ABS.               000103

?ASlink-Warning-Invalid address for instruction
         file              module            area              offset
  Refby  <missing>         _divulong         CODE                   FFFFFC
  Defin  <missing>         _divulong         OSEG                   000000
?ASlink-Warning-RAM value 270 too large (256B max)

What could it be?

sdcc -DPFS173 -mpdk15 -o helloworld_pfs173.ihx helloworld.c

SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502 4.2.8 #13656 (MINGW64)

1 Attachments

Discussion

  • Philipp Klaus Krause

    Your program, uses too much RAM. I guess you were already close to the limit, and this change was enough to go beyond.
    However, you should be aware, that even if the linker does not complain (i.e. you are below the link-time limit of 256B), your program might run out of RAM at runtime, if you are close to the limit, and use too much stack space.

     

    Last edit: Philipp Klaus Krause 2022-11-21
  • Konstantin Kim

    Konstantin Kim - 2022-11-22

    I see.
    It's a pity that tiny printf isn't in padauk's libc yet. and we don't have gcc like builtin-printf optimizations.

     
  • Philipp Klaus Krause

    • status: open --> closed
    • assigned_to: Philipp Klaus Krause
    • Group: -->
     
  • Philipp Klaus Krause

    Looks like the question has been answered, so I'm closing this ticket.

     

Log in to post a comment.

Auth0 Logo