임베디드 소프트웨어는 하드웨어와 밀접하다. 그러나 Clean Architecture의 원칙은 임베디드에도 적용된다. 핵심은 하드웨어에서 소프트웨어를 분리하는 것이다.
임베디드의 특수성
임베디드 소프트웨어는:
- 특정 하드웨어에 종속
- 리소스 제약 (메모리, CPU)
- 실시간 요구사항
하지만 이것이 나쁜 구조의 변명이 되어선 안 된다.
펌웨어 vs 소프트웨어
| 구분 | 펌웨어 | 소프트웨어 |
|---|---|---|
| 의존성 | 하드웨어에 종속 | 하드웨어 독립 |
| 테스트 | 타겟에서만 가능 | PC에서 테스트 가능 |
| 이식성 | 낮음 | 높음 |
목표: 펌웨어를 최소화, 소프트웨어를 최대화.
HAL (Hardware Abstraction Layer)
flowchart TB
subgraph Software [소프트웨어 - 하드웨어 독립]
APP[Application]
HAL_I[HAL Interface]
APP --> HAL_I
end
subgraph Firmware [펌웨어 - 하드웨어 종속]
HAL_IMPL[HAL Implementation]
HW[Hardware]
HAL_IMPL --> HW
end
HAL_IMPL -->|구현| HAL_I
| |
오프 타겟 테스팅
HAL 덕분에 PC에서 테스트:
| |
OSAL (OS Abstraction Layer)
OS도 추상화:
| |
핵심
“임베디드 소프트웨어도 Clean Architecture를 적용할 수 있다. HAL과 OSAL로 하드웨어와 OS를 추상화하고, 비즈니스 로직을 독립시켜라.”
![Featured image of post [Clean Architecture] 39. 클린 임베디드 아키텍처](/post/cleanarchitecture/39-clean-embedded-architecture-hardware-separation/wordcloud_hu_7f45162881114a1a.png)
![[Clean Architecture] 37. 서비스: 아키텍처 경계인가?](/post/cleanarchitecture/37-services-architecture-boundaries-microservices/wordcloud_hu_717de3c0940ae951.png)
![[Clean Architecture] 38. 테스트 경계](/post/cleanarchitecture/38-test-boundary-testing-as-system-part/wordcloud_hu_8cf965efc2badb46.png)
![[Clean Architecture] 39. 클린 임베디드 아키텍처](/post/cleanarchitecture/39-clean-embedded-architecture-hardware-separation/wordcloud_hu_f80f190279d491eb.png)
![[Clean Architecture] 40. 세부사항 서론](/post/cleanarchitecture/40-details-introduction-interchangeable-parts/wordcloud_hu_6d3c7574feb4b30a.png)
![[Clean Architecture] 41. 데이터베이스는 세부사항이다](/post/cleanarchitecture/41-database-is-detail-persistence/wordcloud_hu_8ae66f23a43bd806.png)
![[Clean Architecture] 03. 헥사고날 아키텍처 (Ports and Adapters)](/post/cleanarchitecture/03-hexagonal-architecture-ports-adapters/wordcloud_hu_cb3987382ba39fc1.png)
![[Clean Architecture] 04. 어니언 아키텍처: 도메인 중심 설계](/post/cleanarchitecture/04-onion-architecture-domain-centric-design/wordcloud_hu_8dcb4f53dc938ccb.png)
![[Clean Architecture] 16. OCP: 개방-폐쇄 원칙](/post/cleanarchitecture/16-ocp-open-closed-principle/wordcloud_hu_bbad76b436e60e7f.png)
![[Clean Architecture] 27. 경계: 선 긋기와 플러그인 아키텍처](/post/cleanarchitecture/27-boundaries-drawing-lines-plugin-architecture/wordcloud_hu_fc36676e3ba6ff35.png)
![[Clean Architecture] 29. 정책과 수준](/post/cleanarchitecture/29-policy-and-level-high-level-dependency/wordcloud_hu_e48501593aac0e11.png)