Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] meson for TI c6000 compile incorrect file #13986

Closed
Freed-Wu opened this issue Dec 9, 2024 · 3 comments
Closed

[bug] meson for TI c6000 compile incorrect file #13986

Freed-Wu opened this issue Dec 9, 2024 · 3 comments

Comments

@Freed-Wu
Copy link
Contributor

Freed-Wu commented Dec 9, 2024

Describe the bug

meson support for TI C6000 is incorrect

To Reproduce

Download ti_cgt_c6000_7.4.24_linux_installer_x86.bin

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
  printf("1 = %d\n", 1);
  return EXIT_SUCCESS;
}
project('demo', 'c', version: '0.0.1')

executable('main', 'main.c')
# Cross file tested on Texas Instruments C6000 compiler (bare metal DSP devices)
# This file assumes that path to the Texas Instruments C6000 toolchain is added
# to the environment(PATH) variable.

[host_machine]
system = 'c6000'
cpu_family = 'c6000'
cpu = 'c64x'
endian = 'little'

[binaries]
c = 'cl6x'
cpp = 'cl6x'
ar = 'ar6x'
strip = 'strip6x'
nm = 'nm6x'
as = 'asm6x'

[properties]
needs_exe_wrapper = true
has_function_printf = true
bits = 32

# https://github.com/mesonbuild/meson/blob/master/cross/ti-c6000.txt
$ meson setup --cross=ti-c6000.txt build
$ meson compile -Cbuild --verbose
[2/2] Linking target main.out
<Linking>
[1/2] cl6x -I=main.out.p -I=. -I=.. -O0 -g --preproc_with_compile --preproc_dependency=main.out.p/main.c.o.d --output_file=main.out.p/main.c.o ../main.c
[2/2] cl6x  -z --output_file=main.out main.out.p/main.c.o
warning: no suitable entry-point found; setting to 0
$ ls -al build/main.out
Permissions Size User Date Modified Name
.rw-r--r--  3.2k wzy   9 Dec 19:41   build/main.out

Expected behavior

$ cl6x main.c -z
<Linking>
$ ls -al a.out
Permissions Size User Date Modified Name
.rw-r--r--  159k wzy   9 Dec 19:36   a.out

File size should be correct.

system parameters

  • Is a cross build
  • what operating system NixOS
  • what Python version are you using e.g. 3.12.7
  • what meson --version 1.6.0
  • what ninja --version 1.12.1
@Freed-Wu Freed-Wu changed the title meson for TI c6000 compile incorrect file [bug] meson for TI c6000 compile incorrect file Dec 9, 2024
@Freed-Wu
Copy link
Contributor Author

Freed-Wu commented Dec 9, 2024

BTW,

$ cl6x -h
...
--include_path,-I=dir        Add dir to #include search path

In fact, -Idir can also work, and be helpful to fix clangd/clangd#2249

@Freed-Wu
Copy link
Contributor Author

Freed-Wu commented Dec 9, 2024

The bug is because

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/518163/warning-no-suitable-entry-point-found-setting-to-0

When linking C or C++ code, you must use the linker option --rom_model or --ram_model

If user don't set any --XXX_model, we must have a default.

@Freed-Wu
Copy link
Contributor Author

It is hard to realize, because user can declare --XXX_model in *.cmd file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant