Forum Rule: Always post complete source code & details to reproduce any issue!
Page 4 of 4 FirstFirst ... 2 3 4
Results 76 to 89 of 89

Thread: Teensyduino 1.54 Beta #6

  1. #76
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,448
    I will take a look,

    I remember from my other size program based off of Franks stuff (https://github.com/KurtE/imxrt-size)
    simply returned -1 from main which caused the build to error out.

  2. #77
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,731
    This new size program parses the binary .elf file directly, so we're not depending on the specifics of a human readable text format. ELF 32 bit is a very stable binary format.

    I tried to keep the main program part as simple as possible so it's easy to edit. The elf parsing code is a bit complicated, but you shouldn't need to dive into that code, as it gives easy function to get the size of any of the linker script's output segments. That's not depending on any symbol values. It's the actual size of the binary segments the compiler generated.

    There's also a function you can call to fetch any symbol value, if you know its name. So you could grab the values like "_estack" or "_heap_start" or "_ebss" if you like. Currently it's only used to grab the Teensy model number.

  3. #78
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,448
    Thanks,

    Will play soon, trying to help someone update the RF24 library right now to handle multiple SPI ports.

  4. #79
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,448
    I submitted a PR for first pass:

    I have an RA8876... test sketch that did a picture embed. That compiled fine with PROGMEM defined, but if as I have now, commented that out, it errors out the build.

    I did the compute for free stack space using int32_t and return -1 from program if it is <= 0

    Click image for larger version. 

Name:	screenshot.jpg 
Views:	13 
Size:	57.4 KB 
ID:	23790

    Note: I printed out the value using %d so it shows the minus number.

    Wondering if I should do the same for Free for files and free for malloc as well?
    Attached Files Attached Files

  5. #80
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,448
    Decided to go ahead and check the other two regions as well and error out.

    Also print out message... Feel free to change anything

    Click image for larger version. 

Name:	screenshot.jpg 
Views:	16 
Size:	57.5 KB 
ID:	23791

  6. #81
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    7,921
    Havn't used it for years.. do we still support the eeprom-files?
    If yes, they should be added.

  7. #82
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,422
    Quote Originally Posted by KurtE View Post
    I submitted a PR for first pass:

    I have an RA8876... test sketch that did a picture embed. That compiled fine with PROGMEM defined, but if as I have now, commented that out, it errors out the build.

    I did the compute for free stack space using int32_t and return -1 from program if it is <= 0

    Click image for larger version. 

Name:	screenshot.jpg 
Views:	13 
Size:	57.4 KB 
ID:	23790

    Note: I printed out the value using %d so it shows the minus number.

    Wondering if I should do the same for Free for files and free for malloc as well?
    When there is an error to result in a '-1' exit - the text "teensy_size: " should NOT be printed on the Error line so it gets proper color coding.

  8. #83
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,422
    Did PR to have ERRORS get highlighted in console:
    Code:
    		char *prefix = "teensy_size: ";
    		if ((free_flash < 0) || (free_for_local <= 0) || (free_for_malloc < 0)) {
    			retval = -1;
    			prefix = "";
    		}
    Would be better to highlight just the error line - but that is more change with selective prefix.
    > maybe just as well to have hole block stand out

  9. #84
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,422
    PR updated for only resources in Error to show in console COLOR.

    github.com/Defragster/teensy_size/blob/patch-1/teensy_size.c

  10. #85
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,422
    If you over alloc in an OBVIOUS way - or even barely:
    The build breaks in ld.exe before getting to run the teensy_size.exe:
    Code:
    t:/arduino-1.8.13_t54/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: address 0x2008e340 of C:\Users\Tim\AppData\Local\Temp\arduino_build_104137/BlinkWithoutDelay.ino.elf section `.bss' is not within region `DTCM'
    t:/arduino-1.8.13_t54/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\Tim\AppData\Local\Temp\arduino_build_104137/BlinkWithoutDelay.ino.elf section `.bss.dma' will not fit in region `RAM'
    t:/arduino-1.8.13_t54/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: address 0x2008e340 of C:\Users\Tim\AppData\Local\Temp\arduino_build_104137/BlinkWithoutDelay.ino.elf section `.bss' is not within region `DTCM'
    t:/arduino-1.8.13_t54/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 60608 bytes
    collect2.exe: error: ld returned 1 exit status
    Error compiling for board Teensy 4.1.
    Running IDE 1.8.13 w/TD 1.54 b6 on Win 10 PRO.

    I wasn't going to bother testing in IDE - with new computer and getting a dos box to build with gcc and finding make ...

    But I did the JAR's and added the platform.txt and put the EXE in to tools ...

    HERE is my built copy of teensy_size.exe nd also the blink sketch : Started with BlinkWithoutDelay.ino.

    Added some allocs:
    Code:
    Memory Usage on Teensy 4.1:
      FLASH: code:35564, data:5632, headers:7212   free for files:8078056
       RAM1: code:32768, variables:25408   free for local variables:466112
       RAM2: variables:24768  free for malloc/new:499520
     EXTRAM: variables:8388608
    When I abuse the buf's to:
    Code:
    EXTMEM char buf[8 * 1024 * 1024];
    DMAMEM char bufX[495 * 1024];
    char bufY[495 * 1024];
    Click image for larger version. 

Name:	T_memsizeram1.png 
Views:	6 
Size:	17.7 KB 
ID:	23802
    Code:
    Memory Usage on Teensy 4.1:
      FLASH: code:35564, data:5632, headers:7212   free for files:8078056
       RAM1: code:32768, variables:521024   free for local variables:-29504
       RAM2: variables:523456  free for malloc/new:832
     EXTRAM: variables:8388608
    Error program exceeds memory space
    exit status -1
    Error compiling for board Teensy 4.1.
    Above says I have 832 bytes free in RAM2, adding 832 shows ZERO free.
    This result when going to :: DMAMEM char bufX[495 * 1024 + 833];
    Code:
    t:/arduino-1.8.13_t54/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\Tim\AppData\Local\Temp\arduino_build_104137/BlinkWithoutDelay.ino.elf section `.bss.dma' will not fit in region `RAM'
    t:/arduino-1.8.13_t54/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 32 bytes
    collect2.exe: error: ld returned 1 exit status
    Error compiling for board Teensy 4.1.

  11. #86
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,422
    Following p#85 shown above.

    It looks like RAM calc goes in 4K chunks? Not a code multiply but from ?? :: "data = elf_section_size(".data");"

    Using this for RAM is too much - like anything higher than 464 :: char bufY[464 * 1024];
    Code:
    Memory Usage on Teensy 4.1:
      FLASH: code:35564, data:5632, headers:7212   free for files:8078056
       RAM1: code:32768, variables:492352   free for local variables:-832
       RAM2: variables:523456  free for malloc/new:832
     EXTRAM: variables:8388608
    Error program exceeds memory space
    But reducing that by 1K to :: char bufY[463 * 1024];
    Code:
    Memory Usage on Teensy 4.1:
      FLASH: code:35564, data:5632, headers:7212   free for files:8078056
       RAM1: code:32768, variables:488256   free for local variables:3264
       RAM2: variables:523456  free for malloc/new:832
     EXTRAM: variables:8388608
    "T:\\arduino-1.8.13_t54\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-size" -A "C:\\Users\\Tim\\AppData\\Local\\Temp\\arduino_build_104137/BlinkWithoutDelay.ino.elf"
    Sketch uses 40464 bytes (0%) of program storage space. Maximum is 8126464 bytes.
    Global variables use 520016 bytes (99%) of dynamic memory, leaving 4272 bytes for local variables. Maximum is 524288 bytes.
    Low memory available, stability problems may occur.

  12. #87
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,448
    @defragster - Looks great. Interesting with Low memory availability messages, I assume they most use a percentage... As 4K free on an LC would be 50%

    I see the changes were pulled in

  13. #88
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,422
    Just put a note on Frank_B's PR Print Hardfaults #535 - that would be good to have in Beta 7 release so a thread could be started to discuss and put it to use on T_4.x's.

    @KurtE - 4K bump was in the error detection as I saw it? Not the low memory. Low memory came in that code at 463 * 1024 , when 3264 bytes left is indicated by teensy_size.exe. But at 464 * 1024 it claimed a 832 byte deficit? - the same -832 up to char bufY[467 * 1024];

    Also note when testing the linker ended up reporting the 'out of memory' error and failing as the 'referred to' .ELF was created { but is NOT present } and the teensy_size.exe was then not called

    Though putting this line in boards.txt caused the Linker to show its math before it reported the error which in that case was more useful than the raw linker error text:
    Code:
    teensy41.build.flags.ld=-Wl,--print-memory-usage,--gc-sections,--relax "-T{build.core.path}/imxrt1062_t41.ld"
    The next step in 1K at : char bufY[496 * 1024];
    Code:
    Memory region         Used Size  Region Size  %age Used
                ITCM:       31772 B       512 KB      6.06%
                DTCM:      525120 B       512 KB    100.16%
                 RAM:      523456 B       512 KB     99.84%
               FLASH:       48416 B      7936 KB      0.60%
    t:/arduino-1.8.13_t54/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: address 0x20080340 of C:\Users\Tim\AppData\Local\Temp\arduino_build_104137/BlinkWithoutDelay.ino.elf section `.bss' is not within region `DTCM'
    t:/arduino-1.8.13_t54/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: address 0x20080340 of C:\Users\Tim\AppData\Local\Temp\arduino_build_104137/BlinkWithoutDelay.ino.elf section `.bss' is not within region `DTCM'
    collect2.exe: error: ld returned 1 exit status
                ERAM:          8 MB        16 MB     50.00%
    Error compiling for board Teensy 4.1.

  14. #89
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,422
    @all : new images of the updated T_4.1 is online :: pjrc.com/store/teensy41.html#pins

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •