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

Support TI-CGT compiler like cmake and meson #5163

Closed
Freed-Wu opened this issue May 28, 2024 · 23 comments
Closed

Support TI-CGT compiler like cmake and meson #5163

Freed-Wu opened this issue May 28, 2024 · 23 comments

Comments

@Freed-Wu
Copy link
Member

Is your feature request related to a problem? Please describe.

TI CGT (code generate tool) are TI's compilers for TI C2000 DSP, TI C6000 DSP, TI Arm board.

Refer https://mesonbuild.com/Reference-tables.html#compiler-ids

Describe the solution you'd like

Support more compliers.

Describe alternatives you've considered

No response

Additional context

No response

@waruqi
Copy link
Member

waruqi commented May 29, 2024

Can you provide compiler download links?

@Freed-Wu
Copy link
Member Author

Freed-Wu commented Jun 7, 2024

@waruqi
Copy link
Member

waruqi commented Jun 8, 2024

Can you provide an example project with cmake or meson? or provide verbose build commands?

@modulo-medito
Copy link

Can you provide an example project with cmake or meson? or provide verbose build commands?

Example project with CMake: ti-c2000-cmake

@Freed-Wu
Copy link
Member Author

Release.zip

A makefile project generated by ccstudio maybe helpful.

@Freed-Wu
Copy link
Member Author

Freed-Wu commented Sep 12, 2024

I use C6000-CGT 7.4.24 because some old chips are not supported by latest version.

@Freed-Wu
Copy link
Member Author

7.4.24 has some incompatible command line option, such as --gcc, which enable some gcc extension feature, which is unnecessary for > 8.0.0.

@Freed-Wu
Copy link
Member Author

For different chip, we should add a *.cmd file in last command line of cl6x.

@star-hengxing
Copy link
Contributor

7.4.24 requires account login to download :(

@Freed-Wu
Copy link
Member Author

Freed-Wu commented Dec 8, 2024

@star-hengxing
Copy link
Contributor

@Freed-Wu
Copy link
Member Author

Freed-Wu commented Dec 9, 2024

Can you provide an example project with cmake or meson? or provide verbose build commands?

here:

  • Download TI-CGT C6000 7.4.24 from here and put its bin/ to $PATH.
  • Download DM6467.cmd. Put it into project root.
    It comes from ccstudio's /opt/ccstudio/ccs/ccs_base/c6000/include/DM6467.cmd
  • Install direnv or source .envrc by yourself to set some environment variables which TI-CGT needs.
  • Install meson, ninja. Temporarily, you need a patch for TI linear assmeble.

BTW, TI-CGT contains tools (compilers,assmebler,...) and C runtime (TI RTS). the latter is open source in BSD. here

$ meson setup --cross-file=meson/ti-c6000.txt build
$ meson compile -Cbuild --verbose
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /nix/store/s2lws03pga0vyq84kfa6h041n8csbg4p-ninja-1.12.1/bin/ninja -C /home/wzy/Desktop/x264-dsp/build -v
ninja: Entering directory `/home/wzy/Desktop/x264-dsp/build'
[1/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/output.c.o.d --output_file=x264.out.p/output.c.o ../output.c
[2/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/encoder_lookahead.c.o.d --output_file=x264.out.p/encoder_lookahead.c.o ../encoder/lookahead.c
[3/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/input.c.o.d --output_file=x264.out.p/input.c.o ../input.c
[4/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/downsample.c.o.d --output_file=x264.out.p/downsample.c.o ../downsample.c
[5/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/x264.c.o.d --output_file=x264.out.p/x264.c.o ../x264.c
[6/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/encoder_cavlc.c.o.d --output_file=x264.out.p/encoder_cavlc.c.o ../encoder/cavlc.c
[7/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/encoder_cabac.c.o.d --output_file=x264.out.p/encoder_cabac.c.o ../encoder/cabac.c
[8/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_bitstream.c.o.d --output_file=x264.out.p/common_bitstream.c.o ../common/bitstream.c
[9/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/encoder_macroblock.c.o.d --output_file=x264.out.p/encoder_macroblock.c.o ../encoder/macroblock.c
[10/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/encoder_slicetype.c.o.d --output_file=x264.out.p/encoder_slicetype.c.o ../encoder/slicetype.c
[11/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_cabac.c.o.d --output_file=x264.out.p/common_cabac.c.o ../common/cabac.c
[12/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/encoder_me.c.o.d --output_file=x264.out.p/encoder_me.c.o ../encoder/me.c
[13/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_dct.c.o.d --output_file=x264.out.p/common_dct.c.o ../common/dct.c
[14/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/encoder_analyse.c.o.d --output_file=x264.out.p/encoder_analyse.c.o ../encoder/analyse.c
[15/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_common.c.o.d --output_file=x264.out.p/common_common.c.o ../common/common.c
[16/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_mc.c.o.d --output_file=x264.out.p/common_mc.c.o ../common/mc.c
[17/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_mvpred.c.o.d --output_file=x264.out.p/common_mvpred.c.o ../common/mvpred.c
[18/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_deblock.c.o.d --output_file=x264.out.p/common_deblock.c.o ../common/deblock.c
[19/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_set.c.o.d --output_file=x264.out.p/common_set.c.o ../common/set.c
[20/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_quant.c.o.d --output_file=x264.out.p/common_quant.c.o ../common/quant.c
[21/36] cl6x -I=x264.out.p -O0 -g --gcc -mv64+ -I=.. -I=. -I=x264.out.p --preproc_with_compile --preproc_dependency=x264.out.p/common_bitstream-a.sa.o.d --output_file=x264.out.p/common_bitstream-a.sa.o ../common/bitstream-a.sa
[22/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_vlc.c.o.d --output_file=x264.out.p/common_vlc.c.o ../common/vlc.c
[23/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_frame.c.o.d --output_file=x264.out.p/common_frame.c.o ../common/frame.c
[24/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_predict.c.o.d --output_file=x264.out.p/common_predict.c.o ../common/predict.c
[25/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/encoder_set.c.o.d --output_file=x264.out.p/encoder_set.c.o ../encoder/set.c
[26/36] cl6x -I=x264.out.p -O0 -g --gcc -mv64+ -I=.. -I=. -I=x264.out.p --preproc_with_compile --preproc_dependency=x264.out.p/common_quant-a.sa.o.d --output_file=x264.out.p/common_quant-a.sa.o ../common/quant-a.sa
[27/36] cl6x -I=x264.out.p -O0 -g --gcc -mv64+ -I=.. -I=. -I=x264.out.p --preproc_with_compile --preproc_dependency=x264.out.p/common_predict-a.sa.o.d --output_file=x264.out.p/common_predict-a.sa.o ../common/predict-a.sa
[28/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_macroblock.c.o.d --output_file=x264.out.p/common_macroblock.c.o ../common/macroblock.c
[29/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/common_pixel.c.o.d --output_file=x264.out.p/common_pixel.c.o ../common/pixel.c
[30/36] cl6x -I=x264.out.p -O0 -g --gcc -mv64+ -I=.. -I=. -I=x264.out.p --preproc_with_compile --preproc_dependency=x264.out.p/common_dct-a.sa.o.d --output_file=x264.out.p/common_dct-a.sa.o ../common/dct-a.sa
[31/36] cl6x -I=x264.out.p -O0 -g --gcc -mv64+ -I=.. -I=. -I=x264.out.p --preproc_with_compile --preproc_dependency=x264.out.p/common_deblock-a.sa.o.d --output_file=x264.out.p/common_deblock-a.sa.o ../common/deblock-a.sa
[32/36] cl6x -I=x264.out.p -O0 -g --gcc -mv64+ -I=.. -I=. -I=x264.out.p --preproc_with_compile --preproc_dependency=x264.out.p/common_mc-a.sa.o.d --output_file=x264.out.p/common_mc-a.sa.o ../common/mc-a.sa
[33/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/encoder_ratecontrol.c.o.d --output_file=x264.out.p/encoder_ratecontrol.c.o ../encoder/ratecontrol.c
[34/36] cl6x -I=x264.out.p -I=. -I=.. -O0 -g --gcc -mv64+ --preproc_with_compile --preproc_dependency=x264.out.p/encoder_encoder.c.o.d --output_file=x264.out.p/encoder_encoder.c.o ../encoder/encoder.c
[35/36] cl6x -I=x264.out.p -O0 -g --gcc -mv64+ -I=.. -I=. -I=x264.out.p --preproc_with_compile --preproc_dependency=x264.out.p/common_pixel-a.sa.o.d --output_file=x264.out.p/common_pixel-a.sa.o ../common/pixel-a.sa
[36/36] cl6x -O0 -g --gcc -mv64+ -z --output_file=x264.out x264.out.p/downsample.c.o x264.out.p/input.c.o x264.out.p/output.c.o x264.out.p/x264.c.o x264.out.p/encoder_analyse.c.o x264.out.p/encoder_cabac.c.o x264.out.p/encoder_cavlc.c.o x264.out.p/encoder_encoder.c.o x264.out.p/encoder_lookahead.c.o x264.out.p/encoder_macroblock.c.o x264.out.p/encoder_me.c.o x264.out.p/encoder_ratecontrol.c.o x264.out.p/encoder_set.c.o x264.out.p/encoder_slicetype.c.o x264.out.p/common_bitstream.c.o x264.out.p/common_cabac.c.o x264.out.p/common_common.c.o x264.out.p/common_dct.c.o x264.out.p/common_deblock.c.o x264.out.p/common_frame.c.o x264.out.p/common_macroblock.c.o x264.out.p/common_mc.c.o x264.out.p/common_mvpred.c.o x264.out.p/common_pixel.c.o x264.out.p/common_predict.c.o x264.out.p/common_quant.c.o x264.out.p/common_set.c.o x264.out.p/common_vlc.c.o x264.out.p/common_bitstream-a.sa.o x264.out.p/common_dct-a.sa.o x264.out.p/common_deblock-a.sa.o x264.out.p/common_mc-a.sa.o x264.out.p/common_pixel-a.sa.o x264.out.p/common_predict-a.sa.o x264.out.p/common_quant-a.sa.o --issue_remarks --rom_model --heap_size=0x1000000 --stack_size=0x1000000 /home/wzy/Desktop/x264-dsp/DM6467.cmd
<Linking>
remark: automatic RTS selection:  linking in index library "libc.a"
remark: automatic RTS selection:  linking in "rts64plus.lib" in place of index
   library "libc.a"

@Freed-Wu
Copy link
Member Author

redirect to login page.

A backup without login is here

an example project with cmake or meson

detail about build a TI C6000 DSP executable file by meson
Download the toolchain the upper link to try it.

@waruqi
Copy link
Member

waruqi commented Jan 23, 2025

A backup without login is here

It is not an official source. so it cannot be added to xmake-repo.

@waruqi
Copy link
Member

waruqi commented Jan 23, 2025

detail about build a TI C6000 DSP executable file by meson
Download the toolchain the upper link to try it.

please provide a basic console/static/shared project (hello world) and full compile/link commands

@waruqi
Copy link
Member

waruqi commented Jan 23, 2025

Also, which are compilers and which are linkers, and what is the difference between them?

Do we only need to support cl6x?

ruki@73e655426012:/tmp$ ls -l ./c6000_7.4.24/bin/
total 95076
-rwxr-xr-x. 1 ruki ruki 2515049 Feb 22  2018 abs6x
-rwxr-xr-x. 1 ruki ruki 4898345 Feb 22  2018 acp6x
-rwxr-xr-x. 1 ruki ruki 4921112 Feb 22  2018 acpia6x
-rwxr-xr-x. 1 ruki ruki 3164867 Feb 22  2018 ap6x
-rwxr-xr-x. 1 ruki ruki 3346803 Feb 22  2018 ap6x3
-rwxr-xr-x. 1 ruki ruki 2370838 Feb 22  2018 ar6x
-rwxr-xr-x. 1 ruki ruki 3684819 Feb 22  2018 asm6x
-rwxr-xr-x. 1 ruki ruki 6063792 Feb 22  2018 cg6x
-rwxr-xr-x. 1 ruki ruki 7386329 Feb 22  2018 cg6x3
-rwxr-xr-x. 1 ruki ruki 1724977 Feb 22  2018 ci6x
-rwxr-xr-x. 1 ruki ruki 2831934 Feb 22  2018 cl6x
-rwxr-xr-x. 1 ruki ruki  981244 Feb 22  2018 clist6x
-rwxr-xr-x. 1 ruki ruki 1681375 Feb 22  2018 clt6x
-rwxr-xr-x. 1 ruki ruki 3480540 Feb 22  2018 cmp6x
-rwxr-xr-x. 1 ruki ruki 1651854 Feb 22  2018 dem6x
-rwxr-xr-x. 1 ruki ruki 3072756 Feb 22  2018 dis6x
-rwxr-xr-x. 1 ruki ruki 2650623 Feb 22  2018 embed6x
-rwxr-xr-x. 1 ruki ruki 2842302 Feb 22  2018 hex6x
-rwxr-xr-x. 1 ruki ruki 2679219 Feb 22  2018 ilk6x
-rwxr-xr-x. 1 ruki ruki 2635541 Feb 22  2018 libinfo6x
-rwxr-xr-x. 1 ruki ruki 5218069 Feb 22  2018 lnk6x
-rwxr-xr-x. 1 ruki ruki 2543489 Feb 22  2018 nm6x
-rwxr-xr-x. 1 ruki ruki 3028489 Feb 22  2018 ofd6x
-rwxr-xr-x. 1 ruki ruki 8598788 Feb 22  2018 opt6x
-rwxr-xr-x. 1 ruki ruki 2906204 Feb 22  2018 pdd6x
-rwxr-xr-x. 1 ruki ruki 2270375 Feb 22  2018 pprof6x
-rwxr-xr-x. 1 ruki ruki 3123997 Feb 22  2018 prelink6x
-rwxr-xr-x. 1 ruki ruki 2504473 Feb 22  2018 strip6x
-rwxr-xr-x. 1 ruki ruki 2515221 Feb 22  2018 xref6x

@Freed-Wu
Copy link
Member Author

Yes, cl6x is compiler and cl6x -z will call linker.

@waruqi
Copy link
Member

waruqi commented Jan 23, 2025

TI C2000 DSP, TI C6000 DSP

What is the difference between them when building. I need the complete project build and link commands to adapt them.

Also, do you need to distinguish between different toolchains? toolchain("ti-c6000") and toolchain("ti-c2000")

or we only use toolchain("ti-cgt")

@Freed-Wu
Copy link
Member Author

complete project build and link commands

#5163 (comment)

toolchain("ti-c6000") and toolchain("ti-c2000")

Looks good.

@waruqi
Copy link
Member

waruqi commented Jan 24, 2025

try this patch: #6111

But I has not ti-c2000

ruki@73e655426012:/tmp/testc$ xmake f --toolchain=ti-c6000 -c
checking for platform ... linux
checking for architecture ... x86_64
ruki@73e655426012:/tmp/testc$ xmake -rv
checking for cl6x ... /tmp/c6000_7.4.24/bin/cl6x
checking for the c compiler (cc) ... cl6x
checking for /tmp/c6000_7.4.24/bin/cl6x ... ok
checking for flags (-O3) ... ok
checking for flags (-DNDEBUG) ... ok
[ 50%]: cache compiling.release src/main.c
/tmp/c6000_7.4.24/bin/cl6x -c --preproc_with_compile -mv64+ -O3 -DNDEBUG --output_file=build/.objs/testc/linux/x86_64/release/src/main.c.o src/main.c
checking for cl6x ... /tmp/c6000_7.4.24/bin/cl6x
checking for the linker (ld) ... cl6x
checking for flags (-O3) ... no
[ 75%]: linking.release testc
/tmp/c6000_7.4.24/bin/cl6x -z --output_file=build/linux/x86_64/release/testc build/.objs/testc/linux/x86_64/release/src/main.c.o -mv64+
<Linking>
warning: no suitable entry-point found; setting to 0
[100%]: build ok, spent 0.23s

@Freed-Wu
Copy link
Member Author

But I has not ti-c2000

This contains one ti-c2000:

https://github.com/EngJay/meson-minimal-ti-c28x-cgt

@waruqi
Copy link
Member

waruqi commented Jan 24, 2025

But I has not ti-c2000

This contains one ti-c2000:

https://github.com/EngJay/meson-minimal-ti-c28x-cgt

done #6113

@waruqi waruqi added this to the v2.9.8 milestone Jan 24, 2025
@waruqi waruqi closed this as completed Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants