|
|
|
|
@@ -20,7 +20,6 @@
|
|
|
|
|
'(doom-modeline-minor-modes t)
|
|
|
|
|
'(doom-modeline-total-line-number t)
|
|
|
|
|
'(fill-column 80)
|
|
|
|
|
'(gdb-debuginfod-enable-setting t)
|
|
|
|
|
'(global-auto-revert-mode t)
|
|
|
|
|
'(global-display-line-numbers-mode t)
|
|
|
|
|
'(global-subword-mode t)
|
|
|
|
|
@@ -36,12 +35,10 @@
|
|
|
|
|
'(lisp-simple-loop-indentation 4)
|
|
|
|
|
'(lisp-tag-body-indentation 4)
|
|
|
|
|
'(lisp-tag-indentation 4)
|
|
|
|
|
'(lsp-copilot-enabled t)
|
|
|
|
|
'(lsp-inline-completion-idle-delay 99999999)
|
|
|
|
|
'(org-agenda-files '("~/org/1.TODO.org"))
|
|
|
|
|
'(package-enable-at-startup nil)
|
|
|
|
|
'(package-selected-packages
|
|
|
|
|
'(realgud treemacs lsp-mode projectile yasnippet spice-mode yasnippet-snippets yaml-mode xterm-color which-key wgrep web-mode vterm vertico treemacs-projectile treemacs-nerd-icons system-packages string-inflection spdx quelpa-use-package pyvenv py-isort protobuf-mode prettier polymode orderless opencl-c-mode ng2-mode multiple-cursors marginalia magit lsp-ui lsp-treemacs lsp-pyright lsp-ltex json-mode go-mode glsl-mode flycheck embark-consult doom-themes doom-modeline dockerfile-mode delight company code-cells cmake-mode clang-format+ blacken aggressive-indent))
|
|
|
|
|
'(code-cells clang-format+ cmake-format xterm-color dockerfile-mode web-mode prettier json-mode py-isort blacken pyvenv yaml-mode lsp-pyright ng2-mode lsp-ltex lsp-treemacs treemacs-nerd-icons treemacs-projectile treemacs lsp-ui lsp-mode which-key flycheck vterm projectile yasnippet-snippets yasnippet aggressive-indent doom-themes company-go zenburn-theme langtool smart-tabs-mode typescript-mode protobuf-mode opencl-mode glsl-mode go-mode markdown-mode srefactor irony cmake-mode company magit use-package))
|
|
|
|
|
'(safe-local-variable-values
|
|
|
|
|
'((vc-follow-symlinks . t)
|
|
|
|
|
(TeX-master . t)
|
|
|
|
|
@@ -73,23 +70,23 @@
|
|
|
|
|
("gnu" . "https://elpa.gnu.org/packages/")))
|
|
|
|
|
(package-initialize)
|
|
|
|
|
|
|
|
|
|
(defvar bootstrap-version)
|
|
|
|
|
(let ((bootstrap-file
|
|
|
|
|
(expand-file-name
|
|
|
|
|
"straight/repos/straight.el/bootstrap.el"
|
|
|
|
|
(or (bound-and-true-p straight-base-dir)
|
|
|
|
|
user-emacs-directory)))
|
|
|
|
|
(bootstrap-version 7))
|
|
|
|
|
(unless (file-exists-p bootstrap-file)
|
|
|
|
|
(with-current-buffer
|
|
|
|
|
(url-retrieve-synchronously
|
|
|
|
|
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
|
|
|
|
|
'silent 'inhibit-cookies)
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(eval-print-last-sexp)))
|
|
|
|
|
(load bootstrap-file nil 'nomessage))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(unless (package-installed-p 'quelpa)
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(url-insert-file-contents "https://raw.githubusercontent.com/quelpa/quelpa/master/quelpa.el")
|
|
|
|
|
(eval-buffer)
|
|
|
|
|
(quelpa-self-upgrade)))
|
|
|
|
|
(setq quelpa-checkout-melpa-p nil)
|
|
|
|
|
(setq quelpa-use-package-inhibit-loading-quelpa t)
|
|
|
|
|
(quelpa
|
|
|
|
|
'(quelpa-use-package
|
|
|
|
|
:fetcher github
|
|
|
|
|
:repo "quelpa/quelpa-use-package"))
|
|
|
|
|
(require 'quelpa-use-package)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(straight-use-package 'use-package)
|
|
|
|
|
(require 'use-package-ensure)
|
|
|
|
|
(setq use-package-always-ensure t)
|
|
|
|
|
|
|
|
|
|
@@ -305,8 +302,6 @@
|
|
|
|
|
:hook
|
|
|
|
|
(embark-collect-mode . consult-preview-at-point-mode))
|
|
|
|
|
|
|
|
|
|
(use-package wgrep)
|
|
|
|
|
|
|
|
|
|
(use-package doom-modeline
|
|
|
|
|
:init
|
|
|
|
|
(doom-modeline-mode 1)
|
|
|
|
|
@@ -354,6 +349,12 @@
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(custom-set-faces
|
|
|
|
|
;; custom-set-faces was added by Custom.
|
|
|
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
|
|
|
;; Your init file should contain only one such instance.
|
|
|
|
|
;; If there is more than one, they won't work right.
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package xterm-color
|
|
|
|
|
:config
|
|
|
|
|
@@ -366,6 +367,49 @@
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; (use-package smart-tabs-mode
|
|
|
|
|
;; :config
|
|
|
|
|
;; (setq-default tab-width 4) ; or any other preferred value
|
|
|
|
|
;; (setq cua-auto-tabify-rectangles nil)
|
|
|
|
|
;; (smart-tabs-advice c-indent-line c-basic-offset)
|
|
|
|
|
;; (smart-tabs-advice c-indent-region c-basic-offset)
|
|
|
|
|
|
|
|
|
|
;; (smart-tabs-add-language-support cmake cmake-mode-hook
|
|
|
|
|
;; (
|
|
|
|
|
;; (cmake-indent . cmake-tab-width)
|
|
|
|
|
;; )
|
|
|
|
|
;; )
|
|
|
|
|
|
|
|
|
|
;; (smart-tabs-add-language-support protobuf protobuf-mode-hook
|
|
|
|
|
;; (
|
|
|
|
|
;; (c-indent-line . c-basic-offset)
|
|
|
|
|
;; (c-indent-region . c-basic-offset)
|
|
|
|
|
;; )
|
|
|
|
|
;; )
|
|
|
|
|
|
|
|
|
|
;; (smart-tabs-add-language-support glsl glsl-mode-hook
|
|
|
|
|
;; (
|
|
|
|
|
;; (c-indent-line . c-basic-offset)
|
|
|
|
|
;; (c-indent-region . c-basic-offset)
|
|
|
|
|
;; )
|
|
|
|
|
;; )
|
|
|
|
|
|
|
|
|
|
;; (smart-tabs-add-language-support opencl opencl-mode-hook
|
|
|
|
|
;; (
|
|
|
|
|
;; (c-indent-line . c-basic-offset)
|
|
|
|
|
;; (c-indent-region . c-basic-offset)
|
|
|
|
|
;; )
|
|
|
|
|
;; )
|
|
|
|
|
|
|
|
|
|
;; (smart-tabs-add-language-support elisp emacs-lisp-mode-hook
|
|
|
|
|
;; (
|
|
|
|
|
;; (lisp-indent-line . lisp-indent-offset)
|
|
|
|
|
;; (lisp-indent-region . lisp-indent-offset)
|
|
|
|
|
;; )
|
|
|
|
|
;; )
|
|
|
|
|
|
|
|
|
|
;; (smart-tabs-insinuate 'c 'c++ 'cmake 'nxml 'protobuf 'glsl 'elisp)
|
|
|
|
|
;; )
|
|
|
|
|
|
|
|
|
|
(use-package aggressive-indent
|
|
|
|
|
:hook
|
|
|
|
|
@@ -395,6 +439,15 @@
|
|
|
|
|
:after yasnippet
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package yasnippet-licenses
|
|
|
|
|
:straight (yasnippet-licenses
|
|
|
|
|
:type git
|
|
|
|
|
:host github
|
|
|
|
|
:repo "atuleu/yasnippet-licenses"
|
|
|
|
|
:files (:defaults "*.el" "snippets")
|
|
|
|
|
)
|
|
|
|
|
:after yasnippet
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -427,9 +480,9 @@
|
|
|
|
|
(use-package cmake-mode
|
|
|
|
|
:ensure-system-package (
|
|
|
|
|
(cmake . cmake)
|
|
|
|
|
(pipx . pipx)
|
|
|
|
|
(cmake-format . "pipx install cmakelang[YAML]")
|
|
|
|
|
(cmake-language-server . "pipx install cmake-language-server")
|
|
|
|
|
(pip . python3-pip)
|
|
|
|
|
(cmake-format . "pip install --user cmakelang[YAML]")
|
|
|
|
|
(cmake-language-server . "pip install --user cmake-language-server")
|
|
|
|
|
)
|
|
|
|
|
:config
|
|
|
|
|
(setq cmake-tab-width 4)
|
|
|
|
|
@@ -515,7 +568,6 @@
|
|
|
|
|
:hook
|
|
|
|
|
(c-mode . lsp-deferred)
|
|
|
|
|
(c++-mode . lsp-deferred)
|
|
|
|
|
(c++-mode . (lambda () (setq-local lsp-enable-on-type-formatting nil)))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package clang-format+
|
|
|
|
|
@@ -608,7 +660,6 @@
|
|
|
|
|
(concat "-imp." ext)
|
|
|
|
|
(concat "-impl." ext)
|
|
|
|
|
".cpp"
|
|
|
|
|
".c"
|
|
|
|
|
)))
|
|
|
|
|
)
|
|
|
|
|
(when (member ext '("c" "cc" "cpp"))
|
|
|
|
|
@@ -632,125 +683,6 @@
|
|
|
|
|
(projectile-related-files-fn-test-with-suffix "cpp" "UTest")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
(defun atu/simplicity-fw-inference (&optional dir)
|
|
|
|
|
"Return simplicity project_name if DIR contains a .slcp file with project_name key"
|
|
|
|
|
(let ((root-dir (projectile-expand-root "" dir)))
|
|
|
|
|
(directory-files root-dir t "\\.slcp$" t))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defvar atu/simplicity-project-name nil
|
|
|
|
|
"The simplicity project name to know about the name of the output files")
|
|
|
|
|
(defvar atu/simplicity-project-mcu-target nil
|
|
|
|
|
"The simplicity MCU target of the current project")
|
|
|
|
|
|
|
|
|
|
(defun atu/simplicity-flash-command ()
|
|
|
|
|
"Returns the flashing command for a project"
|
|
|
|
|
(unless atu/simplicity-project-name
|
|
|
|
|
(error "Not a simplicity project"))
|
|
|
|
|
(unless atu/simplicity-project-mcu-target
|
|
|
|
|
(error "Target not found from configuration"))
|
|
|
|
|
|
|
|
|
|
(format "~/.silabs/slt/installs/archive/commander/commander flash build/base/%s.s37 --device=%s" atu/simplicity-project-name atu/simplicity-project-mcu-target)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun atu/simplicity-jlink-gdb-server-command ()
|
|
|
|
|
"Runs the debugger for the current project"
|
|
|
|
|
(unless atu/simplicity-project-name
|
|
|
|
|
(error "Not a simplicity firmware project"))
|
|
|
|
|
(unless atu/simplicity-project-mcu-target
|
|
|
|
|
(error "Missing MCU target in the project config file"))
|
|
|
|
|
(format "JLinkGDBServer -if swd -port 50000 -swoport 500001 -telnetport 500002 -device %s -rtos GDBServer/RTOSPlugin_FreeRTOS.so" atu/simplicity-project-mcu-target)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun atu/jlink-server-running-p ()
|
|
|
|
|
"Return non-nil if the jlink process server exists and is running."
|
|
|
|
|
(let* ((buf-name (if projectile-per-project-compilation-buffer
|
|
|
|
|
(format "*projectile-task: jlink-gdb-server*<%s>" (projectile-project-name))
|
|
|
|
|
"*projectile-task: jlink-gdb-server*"))
|
|
|
|
|
(buf (get-buffer buf-name))
|
|
|
|
|
(proc (when buf (get-buffer-process buf))))
|
|
|
|
|
(and proc (eq (process-status proc) 'run))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun atu/jlink-server-cleanup (&optional project-dir)
|
|
|
|
|
(let* ( (buf-name (if projectile-per-project-compilation-buffer
|
|
|
|
|
(format "*projectile-task: jlink-gdb-server*<%s>" (projectile-project-name project-dir))
|
|
|
|
|
"*projectile-task: jlink-gdb-server*"))
|
|
|
|
|
(buf (get-buffer buf-name))
|
|
|
|
|
(proc (when buf (get-buffer-process buf))))
|
|
|
|
|
(message "testing %s" buf-name)
|
|
|
|
|
(when proc (eq (process-status proc) 'run)
|
|
|
|
|
(message "Terminating jlink server")
|
|
|
|
|
(interupt-process proc)
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun atu/simplicity-debug ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(unless atu/simplicity-project-name
|
|
|
|
|
(error "Not a simplicity firmware project"))
|
|
|
|
|
(unless (atu/jlink-server-running-p)
|
|
|
|
|
(projectile--run-task "jlink-gdb-server" (atu/simplicity-jlink-gdb-server-command) nil t))
|
|
|
|
|
(let* ((fw-path (projectile-expand-root
|
|
|
|
|
(format "build/base/%s.out" atu/simplicity-project-name)
|
|
|
|
|
))
|
|
|
|
|
(gdb-command (concat "gdb-multiarch -i=mi "
|
|
|
|
|
"-iex \"set debuginfod enabled off\" "
|
|
|
|
|
(format "-ex \"file %s\" " fw-path)
|
|
|
|
|
"-ex \"target remote localhost:50000\" "
|
|
|
|
|
"-ex \"monitor reset\" "
|
|
|
|
|
"-ex \"load\" "
|
|
|
|
|
"-ex \"break main\" "
|
|
|
|
|
"-ex \"continue\" "
|
|
|
|
|
"-ex \"delete 1\" "
|
|
|
|
|
|
|
|
|
|
))
|
|
|
|
|
)
|
|
|
|
|
(unless (file-exists-p fw-path)
|
|
|
|
|
(error "Build project first!"))
|
|
|
|
|
(gdb gdb-command)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(projectile-register-project-type 'simplicity-fw #'atu/simplicity-fw-inference
|
|
|
|
|
:project-file "?*.slcp"
|
|
|
|
|
:configure "cmake -B build -S cmake_gcc --preset=project -DCMAKE_EXPORT_COMPILE_COMMANDS=On"
|
|
|
|
|
:compile "cmake --build build"
|
|
|
|
|
:tasks '(("flash" . atu/simplicity-flash-command)
|
|
|
|
|
("jlink-gdb-server" . atu/simplicity-jlink-gdb-server-command))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun atu/projectile-changed-project (new previous)
|
|
|
|
|
"An hook that will help us define functions and task based on project type"
|
|
|
|
|
(setq atu/simplicity-project-name nil)
|
|
|
|
|
(setq atu/simplicity-project-mcu-target nil)
|
|
|
|
|
(when (eq 'simplicity-fw (projectile-project-type new))
|
|
|
|
|
(let* ((slcp-files (directory-files new t "\\.slcp$" t))
|
|
|
|
|
(slcp-file (car slcp-files)))
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert-file-contents slcp-file)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (re-search-forward "^[ \t]*project_name[ \t]*:\\(.+\\)$" nil t)
|
|
|
|
|
(setq atu/simplicity-project-name (string-trim (match-string 1)))
|
|
|
|
|
(setq atu/simplicity-project-name nil))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (re-search-forward "^[ \t]*id[ \t]*:[ \t]*\\(\\(?:BGM\\|EFR\\|EFM\\)[^[:space:]]*\\)" nil t)
|
|
|
|
|
(setq atu/simplicity-project-mcu-target (match-string 1))
|
|
|
|
|
(setq atu/simplicity-project-mcu-target nil)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
(message "Simplicity firmware project %s targeting %s" atu/simplicity-project-name atu/simplicity-project-mcu-target)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
(unless atu/simplicity-project-mcu-target
|
|
|
|
|
(atu/jlink-server-cleanup previous)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(add-to-list 'projectile-project-changed-functions #'atu/projectile-changed-project)
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; (use-package polymode
|
|
|
|
|
@@ -818,22 +750,19 @@
|
|
|
|
|
(setq lsp-ui-doc-use-webkit t)
|
|
|
|
|
)
|
|
|
|
|
(add-to-list 'lsp-language-id-configuration '("\\.postcss\\'" . "css"))
|
|
|
|
|
(defun atu/lsp-inline-completion-display-toggle-key ()
|
|
|
|
|
"Add or remove `i` key from the lsp-command-map` depending on `lsp-inline-completion-mode`"
|
|
|
|
|
(if lsp-inline-completion-mode
|
|
|
|
|
(define-key lsp-command-map (kbd "i") #'lsp-inline-completion-display)
|
|
|
|
|
(define-key lsp-command-map (kbd "i") nil)))
|
|
|
|
|
|
|
|
|
|
(with-eval-after-load 'lsp-inline-completion
|
|
|
|
|
(define-key lsp-inline-completion-active-map (kbd "C-j") #'lsp-inline-completion-accept)
|
|
|
|
|
(advice-add 'lsp :before
|
|
|
|
|
(lambda (&rest _args)
|
|
|
|
|
(eval '(setf (lsp-session-server-id->folders (lsp-session)) (ht)
|
|
|
|
|
)
|
|
|
|
|
:bind (("C-c C-d" . lsp-ui-doc-toggle))
|
|
|
|
|
|
|
|
|
|
:hook (
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
(setq lsp-completion-provider :none)
|
|
|
|
|
:bind (
|
|
|
|
|
("C-c C-d" . lsp-ui-doc-toggle)
|
|
|
|
|
)
|
|
|
|
|
:hook
|
|
|
|
|
(lsp-mode . lsp-enable-which-key-integration)
|
|
|
|
|
(lsp-inline-completion-mode . lsp-inline-completion-company-integration-mode)
|
|
|
|
|
(lsp-inline-completion-mode . atu/lsp-inline-completion-display-toggle-key)
|
|
|
|
|
)
|
|
|
|
|
:commands
|
|
|
|
|
(lsp lsp-deferred)
|
|
|
|
|
)
|
|
|
|
|
@@ -1133,9 +1062,8 @@
|
|
|
|
|
(dockerfile-mode . lsp-deferred)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package spdx
|
|
|
|
|
:quelpa (spdx :fetcher github :repo "condy0919/spdx.el")
|
|
|
|
|
:straight (:host github :repo "condy0919/spdx.el")
|
|
|
|
|
:bind (:map prog-mode-map
|
|
|
|
|
("C-c i l" . spdx-insert-spdx))
|
|
|
|
|
:custom
|
|
|
|
|
@@ -1144,14 +1072,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(custom-set-faces
|
|
|
|
|
;; custom-set-faces was added by Custom.
|
|
|
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
|
|
|
;; Your init file should contain only one such instance.
|
|
|
|
|
;; If there is more than one, they won't work right.
|
|
|
|
|
)
|
|
|
|
|
;; Local Variables:
|
|
|
|
|
;; vc-follow-symlinks: t
|
|
|
|
|
;; End:
|
|
|
|
|
|