Menu

New: GCBASIC HXL- Memory Map Output

Anobium
2026-06-15
2026-06-15
  • Anobium

    Anobium - 2026-06-15

    Just added GCBASIC HXL- Memory Map Output - avialable from build 1602 ( June 2026).

    A new output file called {sourceGCB}.hxl

    Overview

    GCBASIC and its assembler GCASM now generate a diagnostic memory‑map report that is functionally similar to Microchip’s HEXMATE HXL output.

    The report provides a linearised, human‑readable view of program‑memory usage, showing which regions contain compiled code and which remain unused.

    The purpose mirrors the original HXL format. GCBASIC extends the traditional HXL concept by adding a visual hex‑grid map, making memory analysis easier and more intuitive.

    Structure of the GCASM Output Summary

    A typical output summary contains:

        ### GCASM logfile and output summary ###
    
        ### Command-line arguments ###
        C:\GCstudio\gcbasic\GCBASIC.EXE ... /DO
    
        ### Memory Definition (bytes) ###
        0h-00001FFFh
    
        ### Memory Usage ###
        Input file ranges:
        0h-1h; 4h-5Fh
        Unused ranges:
        2h-3h; 60h-1FFFh
    
        ### Hex Memory Map ###
        Legend:
        -- = Unused memory
        H1 = Used memory
    

    This structure mirrors the HEXMATE HXL file but adds a graphical representation of memory.

    Memory Definition

    The Memory Definition section specifies the linear memory window that GCBASIC will analyse:

        0h–00001FFFh
    

    Unlike HEXMATE, which often uses a generic 64‑Kiword window, GCBASIC uses the actual device memory size, producing a more accurate and device‑specific report.

    Memory Usage (HXL‑Equivalent)

    This section is directly comparable to HEXMATE’s Input file ranges and Unused ranges.

    Input File Ranges

    These are contiguous blocks of addresses that contain compiled program bytes:

        0h–1h; 4h–5Fh
    

    Interpretation:


    `0h–1h` → Reset vector and initial instructions  
    `4h–5Fh` → Main program body
    

    Unused Ranges

    These are the gaps between used blocks:

        2h–3h; 60h–1FFFh
    

    This is equivalent to HEXMATE’s unused‑range reporting and is essential for verifying expected gaps, bootloader boundaries, and linker‑like behaviour.

    Hex Memory Map (GCBASIC‑Exclusive Feature)

    GCBASIC adds a visual hex‑grid map similar to HEXMATE:

        00000000 | H1 H1 -- -- H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
        00000010 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
        00000020 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
        00000030 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
        00000040 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
        00000050 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    

    This grid provides:

    • Byte‑accurate visibility of memory usage
    • Immediate identification of gaps
    • A debugging tool for startup code, ISRs, and padding
    • A way to confirm that GCBASIC is generating dense, efficient code

    How GCBASIC Builds the HXL‑Style Map

    GCBASIC follows a process similar to HEXMATE:

    1. Compile GCBASIC source into GCASM assembly.
    2. Assemble into a HEX file.
    3. Linearise all addresses.
    4. Mark each byte as used or unused.
    5. Consolidate contiguous used regions.
    6. Emit Input and Unused ranges.
    7. Render the visual hex‑grid map.

    The key difference is that GCBASIC uses the actual device memory limits and integrates the report directly into the compiler output.

    Comparison: HEXMATE HXL vs GCBASIC Output

    Feature HEXMATE HXL GCBASIC/GCASM
    Microcontroller Support PIC PIC, AVR & LGT
    Input file ranges Yes Yes
    Unused ranges Yes Yes
    Linearised address space Yes Yes
    Device‑specific memory window No Yes
    Visual hex‑grid map Yes Yes
    Integrated into compiler No Yes
    Config‑word mapping Yes Yes

    To enable HXL file output file

    There are two options to enable the compiler to produce the HXL output file.

    1. Use the Preferennces Editor, select the Compiler Tab and select the HXL option.
    2. Add the following to your configuration file. Typically, this is called use.ini. A hxloutput = y to the [gcbasic] section.

    [gcbasic]
    hxloutput = y
    debughxloutput = y
    

    Optionally, you can add debug output by using the debughxloutput = y entry.

    Summary

    GCBASIC’s GCASM output summary is effectively a modernised HXL file:

    • Same range reporting
    • Same linear memory model
    • Same diagnostic purpose
    • Enhanced with a visual hex map
    • More accurate due to real device memory limits

    It is a powerful tool for validating memory layout, debugging unexpected gaps, and ensuring correct program placement on microcontrollers.

     
    👍
    1

    Last edit: Anobium 2026-06-15
  • Anobium

    Anobium - 2026-06-15

    An example HXL file.

    ### GCASM logfile and output summary ###
    
    ### Command-line arguments ###
    C:\GCstudio\gcbasic\GCBASIC.EXE C:\userprojects\nugget-fwlib-main\nugget-fwlib-main\examples\006_uart_hello\006_uart_hello.gcb /NP /S:use.ini /F:N /P: /DO
    
    ### Memory Definition (bytes) ###
      0h-00001FFFh
    
    ### Memory Usage ###
     Input file ranges:
      0h-3h; 8h-1C1h; 1000Eh-10017h
     Unused ranges:
      4h-7h; 1C2h-1000Dh
    
    ### Hex Memory Map ###
     Legend:
      -- = Unused memory
      H1 = Used memory            
    ----------------------------------------------------------
             | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    ----------------------------------------------------------
    00000000 | H1 H1 H1 H1 -- -- -- -- H1 H1 H1 H1 H1 H1 H1 H1
    00000010 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000020 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000030 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000040 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000050 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000060 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000070 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000080 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000090 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    000000A0 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    000000B0 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    000000C0 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    000000D0 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    000000E0 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    000000F0 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000100 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000110 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000120 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000130 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000140 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000150 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000160 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000170 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000180 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    00000190 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    000001A0 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    000001B0 | H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1 H1
    000001C0 | H1 H1 -- -- -- -- -- -- -- -- -- -- -- -- -- --
    ----------------------------------------------------------
    00010000 | -- -- -- -- -- -- -- -- -- -- -- -- -- -- H1 H1
    00010010 | H1 H1 H1 H1 H1 H1 H1 H1 -- -- -- -- -- -- -- --
    ----------------------------------------------------------
    
     

Log in to post a comment.

MongoDB Logo MongoDB