1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RX65N のクロスコンパイラーを使う

Last updated at Posted at 2021-10-04

Ubuntu 21.04 で確認しました。

次のサイトからダウンロードします。
Toolchainsダウンロード Renesas RX
ダウンロードするには、ログインする必要があります。

次のファイルがダウンロードされます。

gcc-8.3.0.202102-GNURX-ELF.run

インストール

chmod +x gcc-8.3.0.202102-GNURX-ELF.run
./gcc-8.3.0.202102-GNURX-ELF.run

$HOME/toolchains にインストールされます。

パスの設定

(省略)
export PATH=$PATH:/home/uchida/toolchains/gcc_8.3.0.202102_gnurx-elf/bin

ログインし直してパスを有効にします。

バージョンの確認

$ rx-elf-gcc --version
rx-elf-gcc (GCC_Build_20210527) 8.3.0.202102-GNURX 20190222
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

サンプルのプログラム

hello.c
# include <stdio.h>

int main(void)

{   
  int ret;

  ret = printf("Hello World!\r\n");

  return ret;
}
Makefile
hello.out: hello.c
	rx-elf-gcc  hello.c -o hello.out -g -msim
clean:
	rm -f hello.out

実行

$ rx-elf-run hello.out
Hello World!

もう少し複雑なサンプル

ex01.c
# include <stdio.h>

void main(void)
{   
	printf("*** start ***\n");

	int nmax = 20;
	for (int it=1; it<nmax; it++)
		{
		int it2 = it * it;
		for (int jt=it; jt<nmax; jt++)
			{
			int jt2 = jt * jt;
			int itjt2 = it2 + jt2;
			for (int kt=jt; kt<nmax; kt++)
				{
				int kt2 = kt * kt;
				if (itjt2 == kt2)
					{
					printf("%d\t%d\t%d\n",it,jt,kt);
					}
				}
			}
		}

	printf("*** end ***\n");

}
Makefile
ex01.out: ex01.c
	rx-elf-gcc  ex01.c -o ex01.out -g -msim
clean:
	rm -f ex01.out

実行結果

$ rx-elf-run ex01.out
*** start ***
3	4	5
5	12	13
6	8	10
8	15	17
9	12	15
*** end ***

RX デバイスへのプログラムの書き込み方法についてはこちら
Renesas RX マイコン・フラッシュ・プログラミング・ツール (rx_prog)

コンパイル

git clone https://github.com/hirakuni45/RX
cd RX/rxprog/
make

バージョンの確認

$ ./rx_prog
Renesas RX Series Programmer Version 1.30
Copyright (C) 2016,2020 Hiramatsu Kunihito (hira@rvf-rc45.net)

rx_prog の使い方については、こちら
マルチプラットホーム、RXマイコン、フラッシュプログラム

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?