Coder Social home page Coder Social logo

Comments (5)

AGPX avatar AGPX commented on May 19, 2024

Ok, I've solved the previous error by copying the msvcrtd.lib in the 'C:/AGPX/Documenti/llvm-mos-sdk/build/commodore/64/lib' directory and renaming it in 'libmsvcrtd.a', but the 'examples/hello_putchar.c' doesn't works (bad code generation, looks like it output a 'brk'):

image

It 'crash' at location 0902 that have a BRK. What I miss? The hello.prg is 432 bytes long.

I have tried to generate the .s with:

..\llvm-mos\bin\clang.exe --config build/commodore/64.cfg -Os -o hello.s -Wl,--lto-emit-asm examples/hello_putchar.c

and I've obtained a HUGE .s file (246,444 bytes!) and the main is totally different from the one you showed:

        .text
        .file   "ld-temp.o"
        .section        .text.main,"ax",@progbits
        .globl  main
        .type   main,@function
main:
.Lfunc_begin0:
        lda     mos8(__rc30)
        pha
        lda     mos8(__rc31)
        pha
        lda     mos8(__rc32)
        pha
        lda     mos8(__rc33)
        pha
        lda     #16
        sta     __main_sstk
        lda     #72
        sta     __main_sstk+2
        lda     #mos16lo(.str+1)
        sta     __main_sstk+1
        ldy     #mos16hi(.str+1)
.LBB0_1:
        lda     __main_sstk+1
        sta     mos8(__rc33)
        sta     mos8(__rc30)
        sty     mos8(__rc31)
        sty     mos8(__rc32)
        lda     __main_sstk+2
        jsr     __putchar
        ldy     #0
        lda     (mos8(__rc30)),y
        sta     __main_sstk+2
        clc
        lda     __main_sstk
        adc     #-1
        tax
        clc
        lda     mos8(__rc33)
        adc     #1
        sta     __main_sstk+1
        lda     mos8(__rc32)
        adc     #0
        tay
        txa
        stx     __main_sstk
        cpx     #0
        bne     .LBB0_1
        ldx     #0
        lda     #0
        sta     mos8(__rc28)
        pla
        sta     mos8(__rc33)
        pla
        sta     mos8(__rc32)
        pla
        sta     mos8(__rc31)
        pla
        sta     mos8(__rc30)
        lda     mos8(__rc28)
        rts
.Lfunc_end0:
        ... (tons of code) ...

I'm really confused. Please, support Windows platform.

from llvm-mos-sdk.

Galfodo avatar Galfodo commented on May 19, 2024

I had the same problems. Here's what I did to fix it for myself:

https://github.com/llvm-mos/llvm-mos-sdk/compare/main...Galfodo:windows-buildsystem-fixes?expand=1

from llvm-mos-sdk.

mysterymath avatar mysterymath commented on May 19, 2024

Just a heads up, @jackoalan is working on a more principled solution for Windows support in the SDK.

The root of the problem is that CMake defaults the target platform to the host platform (Windows), even when cross compiling. This doesn't cause any problems on Linux, but it does on Windows.

Should be a PR landing relatively soon with a CMake toolchain file that configures the MOS compilation environment with sensible defaults.

from llvm-mos-sdk.

Galfodo avatar Galfodo commented on May 19, 2024

Nice :) I was going to elaborate on my local changes, but I guess there will be no need. Having host and cross compilation targets in the same (cmake) project is probably not a good idea.

from llvm-mos-sdk.

jackoalan avatar jackoalan commented on May 19, 2024

The SDK refactor is finally merged and tested to work with a Visual Studio 2019 host toolchain. Follow the steps in the updated README (particularly the note for Windows users).

If using CMake for your application project, you may now use find_package(llvm-mos-sdk REQUIRED) as described in the README. Alternatively, existing CMake projects can use the toolchain file via -DCMAKE_TOOLCHAIN_FILE=<sdk-install-prefix>/lib/cmake/llvm-mos-sdk/llvm-mos-toolchain.cmake -DLLVM_MOS_PLATFORM=<platform>. This will ensure that Windows-specific compiler flags do not interfere.

from llvm-mos-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.