個人的なメモ

めもめも.

ブックマーク

https://www.ibm.com/support/knowledgecenter/ja/SSQ2R2_9.5.1/org.eclipse.cdt.doc.user/tasks/cdt_t_debug_exes.htm

 

https://github.com/jitomesky/RPi_Micon_C85book

 

リンカスクリプト、 a.out, COFF, ELF

http://kozos.jp/documents/linker_kernelvm5.pdf

 

■ difference between ELF and COFF

https://microchipdeveloper.com/faq:3156

 

https://yyatsuo.com/post-523/

 

http://softwaretechnique.jp/OS_Development/startup_kernel.html

https://github.com/itareeee/12step-os/blob/master/src/bootload/ld.scr

 

■ gccでCのソースコードからセクションのアドレスを参照する。 - Qiita

https://qiita.com/eggman/items/3693dd2cf32a432f0950

 

■ リンカ・ローダ実践開発テクニック - 38071.pdf

https://shop.cqpub.co.jp/hanbai/books/38/38071/38071.pdf

emacs + anything

手順

https://github.com/emacs-jp/anything
B)の手順に従ってバイトコンパイルする
このとき、contrib/anything-startup.elもload-pathディレクトリに追加しバイトコンパイルする。

anything.el

(require 'anything-startup)
(global-set-key "\C-q" 'anything-for-files)
(require 'anything-config)

参考

バイトコンパイル手順
C-u 0 M-x byte-recompile-directory
https://qiita.com/skkzsh/items/26cec55dc50b1af25297

emacs init.el

emacs_init.el - 個人的なメモ
リファクタリング

init.el

;* search lisp directory path
(setq load-path (cons "~/.emacs.d/elisp/" load-path))

;* load init file
(load "~/.emacs.d/gtags.el")
(load "~/.emacs.d/anything.el")

;* hidden startup-message
(setq inhibit-startup-message t)

;* not create backup files(ex *.~, .#*)
(setq make-backup-files nil)
(setq auto-save-default nil)

;* set char code
(set-language-environment 'Japanese)

;* utf8
(prefer-coding-system 'utf-8)

;* default window size
(setq initial-frame-alist
      '((left   . 100) ; (x)
        (top    .  50) ; (y)
        (width  . 120)
        (height .  40)
        ))

;* hide menu bar
(menu-bar-mode 0)

;* line, column number(mode line)
(line-number-mode t)
(column-number-mode t)

;* display function name
(which-function-mode 1)

;* highlight matching parenthesis
(show-paren-mode t)

;* scroll option
(setq scroll-conservatively 1)
(setq scroll-margin 10)
(setq next-screen-context-lines 10)
(setq scroll-preserve-screen-position t)

;* underline cursor
(global-hl-line-mode)
(setq hl-line-face 'underline)

;* ignore beep sound
(setq ring-bell-function 'ignore)

;* color
;** char color
(add-to-list 'default-frame-alist '(foreground-color . "white"))
;** background
(add-to-list 'default-frame-alist '(alpha . (90 80)))
;** cursor
(add-to-list 'default-frame-alist '(cursor-color . "ghost white"))
;** mark set
(set-face-background 'region "blue")
;** modeline
(set-face-foreground 'mode-line-inactive "gray30")
(set-face-background 'mode-line-inactive "gray85")
;** comment
(set-face-foreground 'font-lock-comment-face "Red")
;** string
(set-face-foreground 'font-lock-string-face  "green")
;** reserved word
(set-face-foreground 'font-lock-keyword-face "cyan")
;** function name
(set-face-foreground 'font-lock-function-name-face "LightSlateBlue")  
(set-face-bold-p 'font-lock-function-name-face t)
;** variable name
(set-face-foreground 'font-lock-variable-name-face "yellow")
;** type name
(set-face-foreground 'font-lock-type-face "Green")
;** buildin function name
(set-face-foreground 'font-lock-builtin-face "LightSlateBlue")  
;** const name
(set-face-foreground 'font-lock-constant-face "DeepPINK")
;** warning(#error)
(set-face-foreground 'font-lock-warning-face "pink")

;* key bind define
;(keyboard-translate ?\C-i ?\M-v); C-i is Scrollup(C-v is Scrolldown)
(keyboard-translate ?\C-h ?\C-?); C-h is backspace

;* indent
(setq-default c-basic-offset 4     ;; indent offset
              tab-width 4          ;; tab width
              indent-tabs-mode t)   ;; indent tab
			  ;indent-tabs-mode nil)  ;; indent space

gtags.el

;* gtags
(autoload 'gtags-mode "gtags" "" t)
(setq gtags-mode-hook
      '(lambda ()
         (local-set-key "\M-t" 'gtags-find-tag)
         (local-set-key "\M-r" 'gtags-find-rtag)
         (local-set-key "\M-s" 'gtags-find-symbol)
         (local-set-key "\C-t" 'gtags-pop-stack)
         ))
(add-hook 'c-mode-common-hook
          '(lambda()
             (gtags-mode 1)
             (gtags-make-complete-list)
             ))

anything.el

(require 'anything-startup)
(global-set-key "\C-q" 'anything-for-files)

(require 'anything-config)

例のやつ

data.txt

___xxx__0.0001__xxx_xxxstart1xxx__
___xxx__0.0002__xxx_xxxxxxxxxxx__
___xxx__0.0005__xxx_xxxxxxxxxxx__
___xxx__0.0007__xxx_xxxxxxxxxxx__
___xxx__0.0010__xxx_xxxxxxend1xx__
___xxx__0.0011__xxx_xxxstart2xxx__
___xxx__0.0012__xxx_xxxxxxxxxxx__
___xxx__0.0011__xxx_xxxstart3xxx__
___xxx__0.0017__xxx_xxxxxxxxxxx__
___xxx__0.0020__xxx_xxxxxxend2xx__
___xxx__0.0025__xxx_xxend3xxxxxx__
___xxx__0.0030__xxx_xxxxxxxxxxx__

hoge.py

#!/usr/local/bin/python3
# coding: utf-8

import re

MAX_NO = 100

if __name__ == "__main__":

    # ファイルを開く
    data = open("data.txt", "r")
    data = data.readlines()

    # 開始時間、終了時間、処理時間を定義
    start_time = [-1 for i in range(MAX_NO)]
    end_time = [-1 for i in range(MAX_NO)]
    ret_time = [-1 for i in range(MAX_NO)]

    i = 0

    # 入力データ出力
    for line in data:
        print(line, end="")
    print()
    
    
    for line in data:
        # start, endの文字位置取得
        index_start = line.find("start")
        index_end =  line.find("end")

        # start, end番号取得
        index_time = re.findall(r'[0-9]+', line[21:32])

        # start文字列が含まれる
        if(index_start != -1):
            # start直後の数字を取得
            index_time = (int((index_time[0])))
            # start時刻を記録
            start_time[index_time] = float(line[8:14])

        # end文字列が含まれる
        elif(index_end != -1):
            # end直後の数字を取得
            index_time = (int((index_time[0])))
            # end時刻を記録
            end_time[index_time] = float(line[8:14])
        
        i = i+1

    # end - start時刻を計算
    for i in range(MAX_NO):
        ret_time[i] = end_time[i] - start_time[i]

    print(start_time)
    print(end_time)
    print(ret_time)

出力結果

[-1, 0.0001, 0.0011, 0.0011, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
[-1, 0.001, 0.002, 0.0025, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
[0, 0.0009, 0.0009, 0.0014, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]